That may sound stupid, but sometimes Latex needs a sign before the \, therefore:
~\\
That very much depends on the distribution you chose. LyX btw. is kind of crazy, when it comes to LaTeX export. Try auctex if you've got a month or two to spare ;)
Unfortunately, no. As the xstring package states:
The macros of this package are not purely expandable
(Section 3.2 of xtring_doc_en.pdf.)
This "expandable" concept, if you're not familiar with it, is quite a hairy subject in TeX. Simply put, something that is not expandable cannot be evaluated as an argument. Anything that uses an assignment somewhere is guaranteed not to be expandable in most TeX varieties, but other non-expandable triggers exist as well. The solution to such problems is rather difficult for anyone that's not familiar with the inner workings of TeX's "mouth" (the part of TeX that handles things like expansion).
Hint: If the LaTeX code is generated by a script: use the script to convert the time expressions, because just about any programming language is easier to use than TeX when it comes to string manipulation. (Or just about anything else for that matter.)
The xstring package does hint at a way out: You can store the result of most operations in a variable, by adding [\variable]
to the end of the calls. This means you'd need to rewrite \timetominutes
to something that builds up the result piece by piece, and then store that result in a command sequence for use later on.
Usage:
\timetominutesinto\somevar{8:00A} % \somevar contains 48
\expandafter\myfunc\expandafter{\somevar} % calls \myfunc{48}
Note the use of \expandafter
, which tells TeX to do a simple one-level expansion (evaluation) of a command sequence after the next. If you didn't use the two \expandafter
s, you'd get \somevar
as an argument to \myfunc
, not 48
.
(Caution: ugly TeX code ahead!)
\makeatletter % allow @ in command names
\def\timetominutesinto#1#2{%
% #1 = command to store the result in
% #2 = the text to parse
% \ttm@tempa and \ttm@tempb are temporary variables for this macro
\let\ttm@tempa\empty % make the command empty
\IfSubStr{#2}{P}{%
\def\ttm@tempa{720+}% set tempa to "720+"
\StrBetween{#2}{:}{P}[\ttm@tempb]% store substring between : and P into tempb
\edef\ttm@tempa{\ttm@tempa \ttm@tempb}% set tempa to tempa + tempb
}{%
\def\ttm@tempa{0+}% set tempa to 0+
\StrBetween{#2}{:}{A}[\ttm@tempb]% store substring between : and A into tempb
\edef\ttm@tempa{\ttm@tempa \ttm@tempb}% set tempa to tempa + tempb
}%
\edef\ttm@tempa{\ttm@tempa+60*}% set tempa to tempa + "+60*"
\StrBefore{#2}{:}[\ttm@tempb]% store substring before : into tempb
% now, set #1 to the result of evaluating the formula returned by concatenating
% tempa and tempb
\edef#1{\numexpr \ttm@tempa \ttm@tempb}%
}
\def
is the TeX primitive corresponding to LaTeX's \newcommand
/\renewcommand
. \edef
means Expanding \def
, which evaluates the definition before assigning the result to a command sequence. \numexpr
evaluates a simple number expression, like x + m + h * 60 created by the command above.
It is also possible to calculate the result immediately as a number, without building up the formula, by using integer arithmetic. But that would make the code even more remote from your original intent.
It is possible to do these string manipulations through TeX itself, without using the xstring
package (even expandible in this particular case). But that's pretty low level stuff, which cannot easily be repeated if you're not a TeX wizzard.
Best Answer
I would definitely consider the advice from Dirk Eddelbuettel, first. However, reformatting the bibliography seems to be something of a black art, but there are two major methods for doing so: custom-bib and biblatex. Custom-bib operates by interrogating you as to the myriad features you might possibly want to use. I've tried to use custom-bib in the past with little success, but others have used it successfully.
Biblatex, however, uses latex commands directly within the document itself (or, style file) to generate the style. Internally, it divides each bib entry into blocks and units with settable punctuation between them (via
\newblockpunct
and\newunitpunct
, respectively), and usually a block is an entire entry. It should be noted that biblatex is still in beta testing, so it may still have some quirks. Also, be sure to check the prerequisites for running it. As of this point, I have not used it, but if the documentation is at all accurate, I intend to.Edit: I looked at the style file again, and it appears that biblatex is implementing the bibliography environment as a list. So, to achieve what you are looking for, you would use paralist instead. You may be able to renew
thebibliography
environment yourself without using biblatex, but you may have to dig through your bst file to figure out what formatting commands are used. The method with biblatex just seems easier.