Hi Aurélio,
%!postproc(tex): '(\\label\{[^}]*)\\_' '\1_' works, thanks for the
hint. (differs by a \ from your suggestion)
Actually this is even saver as the sed command, because anchors can be
used everywhere in the text now. However a anchor mark in the form
[#anchor] would be nice.
Cheers,
Christoph
Am 10.09.2009 18:40, schrieb Aurélio Jargas:
Hello Christoph,
I'm glad to know about your txt2tags use! So many targets in one
single source, that's it!
Thanks for the detailed information about the problem. You can use a
postproc to do the same thing as this sed command is doing:
sed -i '/\label{.*}/s/\_/_/g' *.tex
Try this one at the end of your postprocs:
%!postproc(tex): '(\\label\{[^}]*)\_' '\1_'
You can repeat the filter to substitute two or more \_ that may appear
on the label. Let's say you have a maximum of 4 underscores on each
label.
%!postproc(tex): '(\\label\{[^}]*)\_' '\1_'
%!postproc(tex): '(\\label\{[^}]*)\_' '\1_'
%!postproc(tex): '(\\label\{[^}]*)\_' '\1_'
%!postproc(tex): '(\\label\{[^}]*)\_' '\1_'
Tell me if that worked!
Bye
On Thu, Sep 10, 2009 at 12:42, Christoph
Junghansjungh...@mpip-mainz.mpg.de wrote:
Hi all,
we are using txt2tags to automatically extract descriptions from an xml
file. After parsing we have a t2t file with a long definition list.
We automatically build a manual (in tex) from it, put it on a wiki and
and publish it as html site and manpage. That is what txt2tags was made
for ;-)
As an extension we added anchors in the list. For that we add the
following lines to config.t2t:
% for media wiki
%!postproc(wiki): 'anchor\((.*?)\)' 'span id=\1/span'
% for html
%!postproc(html): 'anchor\((.*?)\)' 'a name=\1/a'
% for tex
%!postproc(tex): 'anchor\((.*?)\)' '\label{\1}'
%For the rest is replaced by nothing.
%!postproc: 'anchor\(.*?\)' ''
Works perfect, but here comes the problem:
In the case of tex target, if the anchor contains a _ it is replaced
by \_ which is not allowed in the \label command in tex.
We solved this problem by running:
sed -i '/\label{.*}/s/\_/_/g' *.tex
Is there a way to solve this internally in txt2tags?
Either by protecting the _ from txt2tags or by a special %!postproc
rules which only acts on line matching a /label/?
Cheers,
Christoph
--
Dipl.-Phys. Christoph Junghans
Max Planck Institute for Polymer Research
Theory Group
POBox 3148
D 55021 Mainz, Germany
Phone: +49 6131 379 335
Web: http://www.mpip-mainz.mpg.de/~junghans
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
___
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list
--
Dipl.-Phys. Christoph Junghans
Max Planck Institute for Polymer Research
Theory Group
POBox 3148
D 55021 Mainz, Germany
Phone: +49 6131 379 335
Web: http://www.mpip-mainz.mpg.de/~junghans
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
___
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list