从 Inkscape 导出(eps + Latex)时避免出现浮动符号

从 Inkscape 导出(eps + Latex)时避免出现浮动符号

我正在关注CTAN 文档用于从 Inkscape 导出带有 LaTeX 符号的 SVG 图像,并将其作为 EPS 图形嵌入到我的 latex 文档中。MWE 如下:

\documentclass[]{article}
\usepackage{epsfig,graphicx,amsmath,amsfonts}
\usepackage{xcolor,import}
\usepackage{transparent}
\begin{document}
 \begin{figure}[h] 
  \centering  
   \def\svgwidth{70mm}  
    \import{}{foo.eps_tex}  
 \end{figure}
\end{document}

其中文件foo.eps_tex是由 Inkscape 生成的(文件 → 另存为... → 封装的 PostScript (*.eps) → EPS+LaTeX)。原始 Inkscape 绘图如下所示: 在此处输入图片描述

PDF(LaTeX + DVItoPs + PStoPDF)中生成的图像如下所示: 在此处输入图片描述

虽然,或多或少,这些符号几乎都位于我想要的位置,但它们并没有按照原始 SVG 绘图精确地放置在正确的位置。当然,我总是可以回到我的绘图,稍微调整一下,然后生成 PDF 以查看它是否看起来不错。但是,我有许多这样的图形要制作,这个过程并不理想。如何让我的 LaTeX 符号在导出 SVG 时不浮动?文件foo.eps_tex附加在下面。

\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}{495.90927734bp}%
\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.91319971)%
\put(0,0){\includegraphics[width=\unitlength]{foo.eps}}%
\put(0.12591704,0.64997299){\color[rgb]{0,0,0}\makebox(0,0) [lb]{\smash{$\Gamma_s$}}}%
\put(0.12401264,0.02224006){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\Omega_ \infty$}}}%
\put(0.45672106,0.40227734){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\Omega_s$}}}%
\put(0.22841188,0.84721223){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$p^{\mathrm{inc}}$}}}%
\put(0.70651045,0.02827193){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\Gamma_s^e$
$\mbox{Element}$}}}%
\put(0.86737431,0.22302397){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\mbox{Node}$}}}%
\end{picture}%
\endgroup%

\import使用而不是的原因\input是为了能够提供图形数据的路径。例如,如果 Inkscape 文件foo.svg和相应的文件foo.eps_tex位于,./Chapter1/那么我将使用(另请参阅类似问题这里

\import{./Chapter1/}{foo.eps_tex} 

答案1

.eps_tex 文件确实很有用,但调整 \put 坐标并没有多大帮助,而且我不知道如何自动化该过程。但是,我尝试导出 .ps 文件而不是 .eps 文件,即文件 → 另存为... → PostScript (*.ps) → PS+LaTeX。查看 .eps 导出和 .ps 导出在生成的 LaTeX 编译的最终 PDF 文件中的比较情况。

这是原始的 SVG 绘图:在此处输入图片描述

这是 .eps 图形在 LaTeX 编译的 PDF 中的样子在此处输入图片描述

最后,这就是 .ps 图形在 LaTex 编译的 PDF 中的样子在此处输入图片描述

.eps 和 .ps 导出中都有一些 x 和 y 偏移,但是 .ps 看起来更接近 Inkscape 中的原始 SVG 绘图。例如,查看原始 SVG 绘图中的 $\Gamma_s$ 符号。它在 .eps 中移动到曲线的另一侧,而在 .ps 导出中其位置大致相同。令人惊讶的是,当我查看 \put 数据的 .eps_tex 和 .ps_tex 文件时,这两个文件完全相同!我不明白为什么 .eps 文件中的符号移动这么多 - 有什么解释吗?我认为以 .ps 格式导出文件暂时解决了我的问题。

相关内容