我正在尝试使用该standalone
包创建一个带有 LaTex 数学注释的 PDF 图形。该 PDF 是从 Inkscape 导出的,使用单独的 LaTex 命令生成,生成两个文件:PDF 和 PDF_TEX。
这是主要的 tex 文件
\documentclass{standalone}
\include{graphicx}
\begin{document}
\begin{figure}
\centering
\def\svgwidth{\linewitdh}
\input{translating-droplet-3D.pdf_tex}
\end{figure}
\end{document}
我得到的错误是:
))))) [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}
该translating-droplet-3D.pdf_tex
文件是:
%% 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%
答案1
你的例子有很多错误
- 缺少包裹:
graphicx
,,,amsmath
amssymb
xcolor
- 缺少定义
\bold
- 环境
figure
没有任何意义 这些行是错误的
\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}}}}%
因为它们
\\
在数学内部,因此tabular
看不到它们。
修复这些问题,它似乎就可以正常运行了。
我不会使用 Inkscape 来实现这一点,我会使用类似的东西
\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}