[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] Latex failure
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] Latex failure |
Date: |
Sat, 1 Dec 2012 00:33:50 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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.
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346