如何确保从 Inkscape 导入绘制的文本位置?

如何确保从 Inkscape 导入绘制的文本位置?

我正在使用 Inkscape 进行绘图,但将它们放入 LaTeX 中时,文本会随机出现。下图是我在 Inkscape 中绘制的

从 inkscape 绘制

我将其放入 LaTeX 中的代码是:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}

\def\svgwidth{0.4\textwidth}
\input{Paletas.pdf_tex}

\end{document}

结果如下

LaTeX 调色板

我试图改变宽度,但文本仍然远离中心。

有人能帮帮我吗??

编辑:我正在上传 Paletas.pdf_tex 的代码

%% Creator: Inkscape 0.91_64bit, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'Paletas.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}{258.49033203bp}%
    \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,1.7028689)%
    \put(0,0){\includegraphics[width=\unitlength,page=1]{Paletas.pdf}}%
    \put(-0.00468465,0.01184764){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$L_{1}=4,3\ cm$}}}%
    \put(0.18499846,0.2154351){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$i=1$}}}%
    \put(0.18499846,0.60902075){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$i=2$}}}%
    \put(0.18499846,1.0026064){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$i=3$}}}%
    \put(0.18499846,1.39619206){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$i=4$}}}%
    \put(0.59258631,0.21557111){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$b=1,6\ cm$}}}%
  \end{picture}%
\endgroup%

答案1

感谢@Johannes_B 和@alwaysask。我尝试了@alwaysask 的方法。我进入了 Inkscape 文件,并使用分布工具将文本居中,但我使用了文本控件中的居中文本选项(Shift+Ctrl+T),它起作用了

相关内容