导入 .pdf_tex 文件

导入 .pdf_tex 文件

我想导入一个.pdf_tex文件,但无法让图形正确显示。我需要做哪些更改?

文档链接:Schichtung.svg Schichtung.pdf Schichtung.pdf_tex

\documentclass[10.5pt,a4paper,oldfontcommands]{memoir}

\usepackage[polutonikogreek, latin, english, french, ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage[dvips]{graphicx}
\usepackage{times}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{latexsym}
\usepackage{stmaryrd}
\usepackage{enumerate}
\usepackage{nicefrac}
\usepackage[all]{xy}
\usepackage{tabularx}
\usepackage{pst-plot,pstricks}
\usepackage{varwidth}
\usepackage{thmtools}
\usepackage{enumitem}
\usepackage{geometry}
\usepackage{float}
\usepackage{siunitx}
\usepackage{natbib} 
\usepackage{graphicx,xcolor}
\usepackage{epstopdf}
\usepackage{pdfpages}


\usepackage{transparent}
\graphicspath{{img/}}

\usepackage{pgfplots}
\def\FunctionF(#1){(#1)^3- 3*(#1)}%

\floatstyle{boxed} 
\restylefloat{figure} 

\usepackage{filecontents}

\usepackage[breaklinks=true,colorlinks=true, linkcolor=black,urlcolor=black,citecolor=black, bookmarks=true,bookmarksopenlevel=2]{hyperref}

\usepackage{geometry}
\geometry{total={210mm,297mm},
left=20mm,right=20mm,
bindingoffset=10mm, top=25mm,bottom=25mm}


\OnehalfSpacing
%\linespread{1.3}


\chapterstyle{lyhne}


\setsecheadstyle{\Large\bfseries\sffamily\raggedright}
\setsubsecheadstyle{\large\bfseries\sffamily\raggedright}
\setsubsubsecheadstyle{\bfseries\sffamily\raggedright}

\pagestyle{plain}
\makepagestyle{plain}
\makeevenfoot{plain}{}{}{\thepage}
\makeoddfoot{plain}{}{}{\thepage}
\makeevenhead{plain}{Kantonsschule Wettingen}{}{Potz Blitz - Gewitter in Theorie und Praxis}
\makeoddhead{plain}{Kantonsschule Wettingen}{}{Potz Blitz - Gewitter in Theorie und Praxis}

\maxsecnumdepth{subsection} 
\maxtocdepth{subsection} 
\bibliographystyle{ksfh_nat}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document} 


\begin{figure}
\centering
\def\svgwidth[width=\textwidth,page=-]
\input{Schichtung.pdf_tex}
\caption{hah}
\end{figure}




\end{document}

答案1

我删除了文本框中单词的换行符Index,因为这些换行符会导致\\插入 - 并非所有情况下都允许这样做。生成的文件 > 另存为... > 另存为类型 > 便携式文档格式 (*.pdf) > PDF + LaTeX 如下所示:

%% Creator: Inkscape 0.91_64bit, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'drawing.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}{595.27559055bp}%
    \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.41428571)%
    \put(0,0){\includegraphics[width=\unitlength,page=1]{drawing.pdf}}%
    \put(0.10986629,1.14048909){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Absolute Stabilität}}}%
    \put(0.07946149,1.06923666){\color[rgb]{0,0,0}\rotatebox{90}{\makebox(0,0)[lb]{\smash{Druck }}}}%
    \put(0.26349269,0.86178884){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Temperatur }}}%
    \put(0,0){\includegraphics[width=\unitlength,page=2]{drawing.pdf}}%
    \put(0.39389412,1.13949763){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Bedingtre Labilität}}}%
    \put(0.3634893,1.06824514){\color[rgb]{0,0,0}\rotatebox{90}{\makebox(0,0)[lb]{\smash{Druck }}}}%
    \put(0.54752051,0.86079738){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Temperatur }}}%
    \put(0,0){\includegraphics[width=\unitlength,page=3]{drawing.pdf}}%
    \put(0.69512417,1.13908496){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Absolute Labilität}}}%
    \put(0.66471934,1.05976906){\color[rgb]{0,0,0}\rotatebox{90}{\makebox(0,0)[lb]{\smash{Druck }}}}%
    \put(0.84875061,0.8603847){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Temperatur }}}%
    \put(0.09777096,0.79185788){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Index}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=4]{drawing.pdf}}%
    \put(0.12220724,0.77376786){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Schichtungsgradient  }}}%
    \put(0.12181624,0.75578196){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Feuchtadiabatischer Gradient }}}%
    \put(0.12142525,0.73740503){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Trockenadiabatischer Gradient }}}%
    \put(0,0){\includegraphics[width=\unitlength,page=5]{drawing.pdf}}%
  \end{picture}%
\endgroup%

请注意显示用法的注释:\input{...pdf_tex},而不是\import{...pdf_tex}

以下最小示例能够导入图像:

在此处输入图片描述

\documentclass{article}

\usepackage{graphicx,xcolor}

\begin{document} 

\begin{figure}
  \centering
  \def\svgwidth{\textwidth}\footnotesize
  \input{drawing.pdf_tex}
\end{figure}

\end{document}

graphicx需要包含导出的.pdf文件,而xcolor由于您的图像包含颜色,因此已添加。

如果你不画图像/图里面LaTeX,您只能使用图像编辑器(在本例中为 Inkscape)的转换协议,这可能会有限制。或者,将图像导出为 PDF没有LaTeX 代码,只需使用

在此处输入图片描述

\documentclass{article}

\usepackage{graphicx}

\begin{document} 

\begin{figure}
  \centering
  \includegraphics[width=\textwidth]{drawing}
\end{figure}

\end{document}

答案2

我发现你的代码有两个问题:

1)语法错误:应该\def\svgwidth[width=\textwidth,page=-]\def\svgwidth{\textwidth}

2)在Schichtung.pdf_tex第 64 行中,删除后面的两个斜线Index:


并确保Schichtung.pdf_tex与你的 tex 文件位于同一目录中,否则将\graphicspath不起作用\input

在此处输入图片描述

题外话:我认为如果你在图中用到线条,那么你也应该在图例中显示相应颜色的线条而不是方框。

相关内容