Discussion:
[t2t] LaTeX commands in txt2tags
rch
2014-11-13 19:35:23 UTC
Permalink
Dear txt2tags- list

Because I've been using LaTeX for a long time,
I'm writing t2t in a sort of hybrid txt2tags x LaTeX dialect.

For example, my t2t references are typed thus
\cite{omega:99}

Getting that postprocessed for xhtml was quite easy
%!postproc(xhtml): '\\cite\{(.*?)\}' '(see ref \1)'

But for LaTeX it seems to be more difficult.
I've ended up with 4 postproc commands
%!postproc(tex): '\\cite\{(.*?)\}' '\cite{\1}'
%!postproc(tex): '\$\\backslash\$' '\\'
%!postproc(tex): '\\\{' '{'
%!postproc(tex): '\\\}' '}'

Could someone tell me how to do the postproc(tex)
for \cite{foobar:2014} in one line?

Richard H
-------- End of Original Message --------
Anne Pacalet
2014-11-17 07:24:05 UTC
Permalink
Hello,
Post by rch
Could someone tell me how to do the postproc(tex)
for \cite{foobar:2014} in one line?
Why don't you rather use preproc to tell txt2tags to keep this
as it is in tex files, like this:

%!preproc(tex): "(\\cite{[^}]*?})" ''\1''

Hope this helps,
--
Anne.
rch
2014-11-20 14:00:08 UTC
Permalink
To my query
Post by rch
Could someone tell me how to do the postproc(tex)
for \cite{foobar:2014} in one line?
Why don't you rather use preproc to tell txt2tags
%!preproc(tex): "(\\cite{[^}]*?})" ''\1''
Thank you! That works perfectly

And, mutatis mutandis, your suggestion also works perfectly for
\ldots
\bibliographystyle{barfoo}

I've got one last problem.
My bib file is at /home/foo_bar/References_bibfile_V001.bib
How do I preserve those underlines ("foo_bar", etc) ?

With
%!preproc(tex): "(\\bibliography{[^}]*?})" ''\1''
then in the *.tex file, \bibliography{ arrives ok,
but the underlines "foo_bar" etc
are transformed to "foo\_bar"

Richard H.
Anne Pacalet
2014-11-20 14:14:15 UTC
Permalink
Post by rch
Thank you! That works perfectly
Great :-)
Post by rch
I've got one last problem.
My bib file is at /home/foo_bar/References_bibfile_V001.bib
How do I preserve those underlines ("foo_bar", etc) ?
I don't know about the underscore preservation,
but an alternative is to specify the path with :

$ bibtex --include-directory=/home/foo_bar

It doesn't solve the problem in the filename itself though.
Sorry.
--
Anne.
Emmanuel
2014-11-21 21:28:44 UTC
Permalink
Post by rch
I've got one last problem.
My bib file is at /home/foo_bar/References_bibfile_V001.bib
How do I preserve those underlines ("foo_bar", etc) ?
One solution is to use postproc to avoid escaping _

%!postproc: BIBFILE foo_bar


''\bibliography{BIBFILE]''

Cheers
Emmanuel

Loading...