Inkscape 中的单词在 pdf_tex 导出时靠得太近

Inkscape 中的单词在 pdf_tex 导出时靠得太近

我想要用 Inkscape 编写以下文本并将其导出到 pdf_tex:

erfasste
Regelgröße $x_{\mathrm{r}}$

但是在Texmaker中运行pdf_tex之后的结果如下所示:

在此处输入图片描述

为什么两行之间没有空白处?

编辑:Inkscape 文件中写入的文本如下所示: 在此处输入图片描述

这是一个单独的文本块。我想用以下代码来实现它:

\begin{document}

\begin{figure}[h]
    \centering
    \begin{normalsize}
        \import{drawing.pdf_tex}
    \end{normalsize}
\end{figure}

\end{document}

我的目录顺序:

  • 主文本
  • 图片
    • 绘图.pdf_tex
    • 图纸.pdf
  • 特克斯
    • 章节

并且代码写在了chap.tex所包含的文件中main.tex

这是我的pdf_tex文件:

%% Creator: Inkscape 1.0.1 (3bc2e813f5, 2020-09-07), www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'Struktur_Regelkreis_3.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}{145.83385778bp}%
    \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.17768981)%
    \lineheight{1}%
    \setlength\tabcolsep{0pt}%
    \put(-0.00140624,0.12063649){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{0}\smash{\begin{tabular}[t]{l}erfasste\\Regelgröße\textit{ $x_{\mathrm{r}}$}\end{tabular}}}}%
  \end{picture}%
\endgroup%

答案1

使用Inkscape 1.1你的代码我得到以下
drawing.pdf_tex

%% 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}{414.74844856bp}%
    \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.1631104)%
    \lineheight{1}%
    \setlength\tabcolsep{0pt}%
    \put(-0.0039783,0.10777583){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}erfasste\\Regelgröße $x_{\mathrm{r}}$\end{tabular}}}}%
  \end{picture}%
\endgroup%

使用复制/过去 A| 工具

xxx

pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3)

% !TeX TS-program = pdflatex

\documentclass{article}
\usepackage{color}

\begin{document}    
    \input{drawing.pdf_tex}     
\end{document}

结果是正确的

A

输出排版为

    \begin{tabular}[t]{l}
        erfasste\\Regelgröße $x_{\mathrm{r}}$
    \end{tabular}

略微\baselineskip 从 12pt 增加到 12.5pt。

更新

您需要添加包colorimport

在我的系统中,该文件drawing.pdf_tex位于同一目录中,main.tex因此我使用

\import{./}{drawing.pdf_tex}

一般来说 \import{<path to file>}{<filename>.pdf_tex}

使用您的目录结构:

吨

这是main.tex

% !TeX TS-program = pdflatex

\documentclass{book}    
\usepackage{xcolor}% needed <<< 
\usepackage{import} % needed <<<

\begin{document}    
\input{./TEX/chap}
\end{document}

这是chap.tex

%% file chap.tex
\chapter{ONE}

 Some text
 
\begin{figure}[h!]
\centering
\begin{normalsize}
    \import{./IMG/}{drawing.pdf_tex}
\end{normalsize}
\end{figure}

生产

b

相关内容