我使用 pdf+tex 输出进行 inkscape 绘图,这样图像字体就可以与文档字体匹配,并且 TeX 可以呈现数学运算。当我缩放图像以包含在文档中时,文本不会缩放(一个众所周知的问题)。如下面的 MWE 所示,我可以手动调整字体大小。我希望能够自动执行此操作,使用一个宏来\svgwidth
重用其参数。(我知道我可能仍然需要调整文本定位。)
我已经查看了该网站上的相关问题。
Inkscape 屏幕截图:
(如果需要,我可以提供 inkscape svg 文件的链接。)
MWE 输出:
妇女权利委员会:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{color} % for inkscape
\usepackage{graphicx}
\begin{document}
Example with 12 point type in a 3 inch box in inkscape.
No size set (so the real thing)
\begin{center}
\input{inkscapeout.pdf_tex}
\end{center}
2/3 size
\begin{center}
\def\svgwidth{2in}
\input{inkscapeout.pdf_tex}
\end{center}
2/3 size with small font
\begin{center}
\def\svgwidth{2in}
\small{
\input{inkscapeout.pdf_tex}
}
\end{center}
2/3 size with tiny font
\begin{center}
\def\svgwidth{2in}
\tiny{
\input{inkscapeout.pdf_tex}
}
\end{center}
\end{document}
最后是 inkscape 生成的 pdf_tex 文件。
%% Creator: Inkscape 0.48.3.1, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'inkscapeout.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}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{215.5bp}%
\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.09907193)%
\put(0,0){\includegraphics[width=\unitlength]{inkscapeout.pdf}}%
\put(0.02059777,0.037881){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Boxed 12 pt mathematics: $x^2 + y^2 = z^2$.}}}%
答案1
没有图像我无法测试,但它看起来像而不是使用
\def\svgwidth{2in}
你想使用
\begin{center}
\resizebox{2in}{!}{\input{inkscapeout.pdf_tex}}
\end{center}
将所有东西缩放到一起。