为什么 Calc->SVG->Inkscape->PDF_Tex 创建的乳胶输入文件中的乳胶文本位置不正确?

为什么 Calc->SVG->Inkscape->PDF_Tex 创建的乳胶输入文件中的乳胶文本位置不正确?

在此处输入图片描述在查看了大量问题和指南之后,我尝试了这两个版本,但最终都将所有文本叠加在图像的左上角。

我选择了从 latex 输出包含文本的 pdf_tex 文件的选项,并且认为应该确保文本位于正确的位置?

\begin{figure}[h]
\centering{
\resizebox{75mm}{!}{\input{images/image.pdf_tex}}
\caption{Top view.}
\label{fig:topView}
}
\end{figure}

\begin{figure}
\def\svgwidth{\linewidth}
\input{images/image.pdf_tex}
\caption{Top view.}
\label{fig:topView}
\end{figure}

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}%
  \ifx\svgwidth\undefined%
    \setlength{\unitlength}{453.54330709bp}%
    \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.5625)%
    \put(0,0){\includegraphics[width=\unitlength,page=1]{images/image.pdf}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{6}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{11}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{16}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{21}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{26}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{31}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{36}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{41}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{46}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{51}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{0}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{5}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{10}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{15}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{20}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{25}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{30}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{35}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{40}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=2]{images/image.pdf}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{Cars}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{Trucks/Vans}}}%
    \put(0,0.5625){\makebox(0,0)[lb]{\smash{Sample}}}%
    \put(-0.35075002,0.13462498){\rotatebox{90}{\makebox(0,0)[lb]{\smash{caption text}}}}%
  \end{picture}%
\endgroup%

链接到从 calc 导入到 inkscape 的 svg 文件(仅使用 calc 保存):https://svgshare.com/i/6gb.svg

答案1

实际上不可能按照发布的方式运行示例,但您的文件清楚地显示了

\put(0,0.5625){\makebox(0,0)[lb]{\smash{Cars}}}%
\put(0,0.5625){\makebox(0,0)[lb]{\smash{Trucks/Vans}}}%
\put(0,0.5625){\makebox(0,0)[lb]{\smash{Sample}}}%

也就是说,所有文本都位于完全相同的坐标上,因此将会叠印。

无法说清这是否是原始文档中的错误或从 svg 转换时出现的错误,但 latex(包括此 tex)必须套印这些文字。

相关内容