gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Latex failure


From: Sebastian Hilbert
Subject: Re: [Gnumed-devel] Latex failure
Date: Sat, 01 Dec 2012 09:31:05 +0100
User-agent: KMail/4.9.3 (Linux/3.2.0-33-generic-pae; KDE/4.9.3; i686; ; )

On Saturday, December 01, 2012 12:33:50 AM Karsten Hilbert wrote:

> On Thu, Nov 29, 2012 at 11:51:44PM +0100, Karsten Hilbert wrote:

> > > it is blackslash in subjective field \ that has resulted

> > > in failed pdf generation. I removed it from temp\gnumed tex

> > > file and i could generate the pdf. No doubt about the

> > > problem. I would send the tex file once i could get it on

> > > internet

> >

> > Well, you found a bug of sorts :-)

> >

> > > {\small S} & {\small Follow up. Stool frequency 2/day. No blood.

> > > Abdominal discomfort+, Fever + mild. Received crocin$\backslash$O2 with

> > > relief} \tabularnewline>

> > What GNUmed does (did) is replace a literal "\" with the

> > string "$\backslash$". "\backslash" is one way to say "print

> > a \ here" in LaTeX. This command, however, only works in

> > what's called Math Mode -- which is started and ended by "$"

> > (which, in turn, is why "$" itself is a special LaTeX

> > character and needs escaping if needed literally).

> >

> > While GNUmed properly inserts "$\backslash$" still *another*

> > layer goes over the content _again_ trying to escape special

> > LaTeX chars inside data. This double-escaping is what's

> > causing the trouble - it escapes the "$"s into "\$"s

> > effectively disabling them from starting/ending Math Mode.

> >

> > I will investigate where the double-escape comes from tomorrow.

>

> Actually, it turned out not to be double-escaping but rather

> a straightforward bug:

>

> def tex_escape_string(text=None):

> """check for special LaTeX characters and transform them"""

>

> text = text.replace(u'\\', u'$\\backslash$')

> text = text.replace(u'{', u'\\{')

> text = text.replace(u'}', u'\\}')

> text = text.replace(u'%', u'\\%')

> text = text.replace(u'&', u'\\&')

> text = text.replace(u'#', u'\\#')

> text = text.replace(u'$', u'\\$')

> text = text.replace(u'_', u'\\_')

> text = text.replace(u_euro, u'\\EUR')

>

> text = text.replace(u'^', u'\\verb#^#')

> text = text.replace('~','\\verb#~#')

>

> return text

>

> This will *first* replace "\" with "$\backslash$" and *then*

> replace "$" with "\$".

>

> That can't work properly :-)

>

> Fixed.

>

> You may want to search your machine for the file

> .../client/pycommon/gmTools.py, within that find the

> function tex_escape_string and MOVE the line

>

> text = text.replace(u'\\', u'$\\backslash$')

>

> AFTER the line

>

> text = text.replace(u'$', u'\\$')

>

> That should do.

>

 

This will be fixed in the 1.2.x point release I think ?

 

I am currently extremely short on time but since there there are users depending on this I will fix this for Ubuntu and Windows as soon as possible (maybe tomorrow).


Sebastian

 

> Karsten


reply via email to

[Prev in Thread] Current Thread [Next in Thread]