0

I am trying to use the standalone package to create a PDF figure annotated with LaTex math. The PDF is generated as export from Inkscape, with separate LaTex commands, resulting in two files: PDF, and PDF_TEX.

Here is the main tex file

\documentclass{standalone}
\include{graphicx}

\begin{document}
\begin{figure}
    \centering
    \def\svgwidth{\linewitdh}
    \input{translating-droplet-3D.pdf_tex}
\end{figure}
\end{document}

And the error I get is:

))))) [1] (./translating-droplet-3D-main.aux)
! Use of \@item doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.5 \begin{figure}

The translating-droplet-3D.pdf_tex file is:

%% Creator: Inkscape inkscape 0.92.4, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'translating-droplet-3D.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics{<filename>.pdf}
%% To scale the image, write
%%   \def\svgwidth{<desired width>}
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%%   \usepackage{import}
%% in the preamble, and then including the image with
%%   \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%%   \graphicspath{{<path to file>/}}
%% 
%% For more information, please see info/svg-inkscape on CTAN:
%%   http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\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}%
  \newcommand*\fsize{\dimexpr\f@size pt\relax}%
  \newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}%
  \ifx\svgwidth\undefined%
    \setlength{\unitlength}{600bp}%
    \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.75)%
    \lineheight{1}%
    \setlength\tabcolsep{0pt}%
    \put(0,0){\includegraphics[width=\unitlength,page=1]{translating-droplet-3D.pdf}}%
    \put(0.6499752,0.5345116){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}mantle\end{tabular}}}}%
    \put(0.1216067,0.37046963){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}mantle\end{tabular}}}}%
    \put(0.39538906,0.54810431){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}outlet\end{tabular}}}}%
    \put(0.53944538,0.3743626){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$u$\end{tabular}}}}%
    \put(0.43142471,0.41043285){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\bold{R}$\end{tabular}}}}%
    \put(0.5430238,0.27992702){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$L_y$\end{tabular}}}}%
    \put(0.34322899,0.20902386){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$L_x$\end{tabular}}}}%
    \put(0.59498329,0.48837383){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$L_z$\end{tabular}}}}%
    \put(0.4277095,0.29070702){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}inlet\end{tabular}}}}%
    \put(0.42834438,0.330298){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$C_z$\end{tabular}}}}%
    \put(0.35955238,0.29738232){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$C_x$\end{tabular}}}}%
    \put(0.40420471,0.25895515){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$C_y$\end{tabular}}}}%
    \put(0.29482182,0.23384769){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$x$\end{tabular}}}}%
    \put(0.2992135,0.26012192){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$y$\end{tabular}}}}%
    \put(0.25313322,0.25050018){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$z$\end{tabular}}}}%
    \put(0.67170294,0.44600819){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=(0,0,1)\\ \\ \nabla p = \vec{0}\\$\end{tabular}}}}%
    \put(0.67044151,0.30097134){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=\vec{0}\\ \\p=0 \\$\end{tabular}}}}%
    \put(0.67170296,0.36924946){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=(0,0,1)\\ \\   \nabla p = \vec{0}\\$\end{tabular}}}}%
    \put(0.63071175,0.44514074){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}inlet:\end{tabular}}}}%
    \put(0.6090646,0.36941223){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}mantel:\end{tabular}}}}%
    \put(0.62517788,0.29987583){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}oulet:\end{tabular}}}}%
    \put(0.20923014,0.14962749){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\bold {R}=0.2, C_x=C_y=0.5, C_z=0.4, L_x=L_y=5\cdot\bold{R}, L_z=6\cdot\bold{R}$\end{tabular}}}}%
    \put(0.63389904,0.24091061){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$t_{end}=0.91s$\end{tabular}}}}%
  \end{picture}%
\endgroup%
12
  • 1
    You have several errors here. \usepackage{graphicx} not \include{graphicx}, ` \def\svgwidth{\linewidth}` not \def\svgwidth{\linewitdh}.
    – daleif
    Apr 1 '20 at 9:39
  • 1
    @tmaric It would probably work better with \documentclass{standalone} \usepackage{graphicx} \begin{document} \input{translating-droplet-3D.pdf_tex} \end{document} (you shouldn't use the figure environment with standalone).
    – frougon
    Apr 1 '20 at 9:39
  • 1
    We are missing a definition of \bold, you are missing \usepackage{xcolor} for the color support
    – daleif
    Apr 1 '20 at 9:40
  • 1
    @daleif Yup, and also translating-droplet-3D.pdf...
    – frougon
    Apr 1 '20 at 9:42
  • 1
    The constructions with tabular and $ ... \\ ... \\ .. $ probably will not work. I'd probably not use Inkscape for this. I'd be placing the math on top of the image using tikz instead. Better control
    – daleif
    Apr 1 '20 at 9:42
2

There are many things wrong with your example

  • missing packages: graphicx, amsmath, amssymb, xcolor
  • missing a definition for \bold
  • the figure env does not make any sense
  • these lines are wrong

    \put(0.67170294,0.44600819){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=(0,0,1)\\ \\ \nabla p = \vec{0}\\$\end{tabular}}}}%
    \put(0.67044151,0.30097134){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=\vec{0}\\ \\p=0 \\$\end{tabular}}}}%
    \put(0.67170296,0.36924946){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=(0,0,1)\\ \\   \nabla p = \vec{0}\\$\end{tabular}}}}%
    

    as the \\ are inside math and thus tabular cannot see them.

Fix these and it seems to run ok.

I would not use Inkscape for this, I'd use something similar to

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{xcolor}
\let\bold\mathbf
\begin{document}
\begin{tikzpicture}
  % place the image such that (0,0) is in the lower left corner of the image
  \node[inner sep=0pt,anchor=south west] at  (0,0)
  {\includegraphics[width=\unitlength,page=1]{translating-droplet-3D.pdf}};

  % next convert your extra stuff into

  % \node at (coordinate) {text};

    % \put(0.6499752,0.5345116){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}mantle\end{tabular}}}}%
    % \put(0.1216067,0.37046963){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}mantle\end{tabular}}}}%
    % \put(0.39538906,0.54810431){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}outlet\end{tabular}}}}%
    % \put(0.53944538,0.3743626){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$u$\end{tabular}}}}%
    % \put(0.43142471,0.41043285){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\bold{R}$\end{tabular}}}}%
    % \put(0.5430238,0.27992702){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$L_y$\end{tabular}}}}%
    % \put(0.34322899,0.20902386){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$L_x$\end{tabular}}}}%
    % \put(0.59498329,0.48837383){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$L_z$\end{tabular}}}}%
    % \put(0.4277095,0.29070702){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}inlet\end{tabular}}}}%
    % \put(0.42834438,0.330298){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$C_z$\end{tabular}}}}%
    % \put(0.35955238,0.29738232){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$C_x$\end{tabular}}}}%
    % \put(0.40420471,0.25895515){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$C_y$\end{tabular}}}}%
    % \put(0.29482182,0.23384769){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$x$\end{tabular}}}}%
    % \put(0.2992135,0.26012192){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$y$\end{tabular}}}}%
    % \put(0.25313322,0.25050018){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$z$\end{tabular}}}}%
    % % \put(0.67170294,0.44600819){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=(0,0,1)\\ \\ \nabla p = \vec{0}\\$\end{tabular}}}}%
    % % \put(0.67044151,0.30097134){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=\vec{0}\\ \\p=0 \\$\end{tabular}}}}%
    % % \put(0.67170296,0.36924946){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{u}=(0,0,1)\\ \\   \nabla p = \vec{0}\\$\end{tabular}}}}%
    % \put(0.63071175,0.44514074){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}inlet:\end{tabular}}}}%
    % \put(0.6090646,0.36941223){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}mantel:\end{tabular}}}}%
    % \put(0.62517788,0.29987583){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}oulet:\end{tabular}}}}%
    % \put(0.20923014,0.14962749){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\bold {R}=0.2, C_x=C_y=0.5, C_z=0.4, L_x=L_y=5\cdot\bold{R}, L_z=6\cdot\bold{R}$\end{tabular}}}}%
    % \put(0.63389904,0.24091061){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$t_{end}=0.91s$\end{tabular}}}}%
\end{tikzpicture}
\end{document}

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.