2

I use LuaLaTeX (up to date MikTeX +TexStudio) and wish to use SVG illutsrations in my document, which are created in MS Visio. here is the original image

As a quick and dirt fix to my problem with svg package I launch inkskape manually with batch file in same manner as svg package is supposed to do it

@echo off
"C:\Program Files\Inkscape\inkscape.exe" -z -D -f %1 -A "%~dpn1.pdf" --export-latex

and compile the document. Here how it looks in the pdf. result image

It looks quite good: the shapes are correct, the font adjusted to the font of the document and enlarged where appropriate. Except it doesn't wrap around to a new line inside the shape.The attempt to force the line break with \newline is ignored. here is the content of pdf_tex file

\begingroup%
  \makeatletter%
  \providecommand\color[2][]{%
    \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
    \renewcommand\color[2][]{}%
  }%
  \providecommand\transparent[1]{%
    \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
    \renewcommand\transparent[1]{}%
  }%
  \providecommand\rotatebox[2]{#2}%
  \ifx\svgwidth\undefined%
    \setlength{\unitlength}{497.74924049bp}%
    \ifx\svgscale\undefined%
      \relax%
    \else%
      \setlength{\unitlength}{\unitlength * \real{\svgscale}}%
    \fi%
  \else%
    \setlength{\unitlength}{\svgwidth}%
  \fi%
  \global\let\svgwidth\undefined%
  \global\let\svgscale\undefined%
  \makeatother%
  \begin{picture}(1,0.40658965)%
    \put(0,0){\includegraphics[width=\unitlength,page=1]{system_abstract.pdf}}%
    \put(0.41094927,0.3789432){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{\large{Measurement board}}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=2]{system_abstract.pdf}}%
    \put(0.85230537,0.31601965){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{\large{Battery}}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=3]{system_abstract.pdf}}%
    \put(0.06182823,0.21124862){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{{\large Raspberry PI 2}\newline Reads the data and adjusts the current}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=4]{system_abstract.pdf}}%
    \put(0.53429834,0.28286294){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Current Actuator}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=5]{system_abstract.pdf}}%
    \put(0.35378604,0.2015892){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{SPI}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=6]{system_abstract.pdf}}%
    \put(0.51717328,0.11581522){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Ammeter+Voltmeter}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=7]{system_abstract.pdf}}%
  \end{picture}%
\endgroup%

Is there a way to fix it? May be with some additional LaTeX code in the image?

1

You could manually split the text in two lines:

\documentclass{article}

\usepackage{graphicx}
\usepackage{xcolor}

\begin{document}

\setlength{\unitlength}{497.74924049bp}%
\begin{picture}(1,0.40658965)%
  \put(0.06182823,0.21124862){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{{\large Raspberry PI 2}}}}%
  \put(0.06182823,0.18){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Reads the data and adjusts the current}}}%
\end{picture}%

\end{document}

Or you could wrap the in a \parbox of appropriate width to get automatic line breaks:

\documentclass{article}

\usepackage{graphicx}
\usepackage{xcolor}

\begin{document}

\setlength{\unitlength}{497.74924049bp}%
\begin{picture}(1,0.40658965)%
  \put(0.06182823,0.21124862){%
    \parbox{3cm}{%  
        {\large Raspberry PI 2}
        Reads the data and adjusts the current
    }%
  }%
\end{picture}%

\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.