PDF+LaTeX incorrectly replaces \\ (two backslashes) by a newline

Bug #1679487 reported by Boris Dalstein
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Medium
Unassigned
inkscape (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have an SVG file which contains text like such, the important part being the double backslash:

$\sboundary f =
\left[\begin{array}{c}
\gamma_1 = [ (e^\circ, \top) ] \\
\gamma_2 = [ (e^\circ, \top) ]
\end{array}\right]$

Using Inkscape 0.91 r13725, on Kubuntu 16.04 64bits, PDF+LaTeX converts the text to the following, that is, replaces the double backslashes by a newline!

    \put(0.50170692,0.32122315){\color[rgb]{0,0,0}\makebox(0,0)[b]{\smash{$\sboundary f =
  \left[\begin{array}{c}
  \gamma_1 = [ (e^\circ, \top) ]

  \gamma_2 = [ (e^\circ, \top) ]
  \end{array}\right]$}}}%

Which makes LaTeX crash with the error:

Runaway argument?
{$\sboundary f = \left [\begin {array}{c} \gamma _1 = [ (e^\circ , \top \ETC.
! Paragraph ended before \makesm@sh was complete.
<to be read again>
                   \par
l.64 \end{array}\right]$}}}
                             %

I do need the backslashes so that the array environment knows where the next row starts. It seems Inkscape is trying to be too smart. In a previous version of Inkscape (sorry, I don't know which), this text used to be correctly exported as the following:

    \put(0.50170692,0.32122315){\color[rgb]{0,0,0}\makebox(0,0)[b]{\smash{$\sboundary f =
\left[\begin{array}{c}
\gamma_1 = [ (e^\circ, \top) ] \\
\gamma_2 = [ (e^\circ, \top) ]
\end{array}\right]$}}}%

Revision history for this message
Boris Dalstein (dalboris) wrote :
Revision history for this message
Boris Dalstein (dalboris) wrote :

PDF export

Revision history for this message
Boris Dalstein (dalboris) wrote :

pdf_tex export

Revision history for this message
Boris Dalstein (dalboris) wrote :

pdf_tex export from a previous Inkscape version (retrieve from my archives)

Revision history for this message
Boris Dalstein (dalboris) wrote :

Note: this SVG file also exhibits the following export error:

https://bugs.launchpad.net/ubuntu/+source/inkscape/+bug/1417470

I fixed it by using the following definition of \includesvg, inspired by one comment in the above bug:

\newcommand{\includesvg}[2][]{%
\executeiffilenewer{images/#2.svg}{images/#2.pdf}%
{\unexpanded{PDF_FILE="./images/#2.pdf"; inkscape -z --file=./images/#2.svg --export-pdf=$PDF_FILE --export-latex; sed -i 's/\\\\/\n/g' ${PDF_FILE}_tex; MAXPAGE=$(pdfinfo $PDF_FILE | grep -oP "(?<=Pages:)\s*[0-9]+" | tr -d " ") ; sed -i "/page=$(($MAXPAGE+1))/,\${/page=/d}" ${PDF_FILE}_tex; } }
\ifthenelse{\isempty{#1}}{\small}{#1}
\input{images/#2.pdf_tex}%
}

jazzynico (jazzynico)
tags: added: exporting extensions-plugins latex pdf
Changed in inkscape:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.