我必须向一家期刊提交一篇用 LaTeX 编写的论文。和往常一样,我将文件分成不同的文件。但是,只能上传一个文件。使用\输入{其他文件}命令。据我所知,这个命令只是插入了其他文件放到实际位置。这对于我的普通 tex 文件来说运行良好,但对于一种特殊情况,它失败了,我不知道为什么。
我使用 gnuplot 生成了一个图形并将其导出为 epslatex。因此,我得到了一个 tex 和 eps 文件。该图包含在主 tex 文件中,如下所示:
\begin{figure}
\scalebox{scale=0.65}{\input{myGraphic}}
\end{figure}
如果我替换内容\输入{我的图形}包含文件本身的全部内容,编译失败。我收到类似 undefined 的错误如果别的... 有人知道为什么会发生这种情况吗?
\begin{figure}
\scalebox{scale=0.65}
{
%content of file
.
.
.
%content of file end
}
\end{figure}
任何提示都非常感谢。提前谢谢 Tobi
PS:gnuplot 文件(*.tex 文件)的输出如下:
% GNUPLOT: LaTeX picture with Postscript
\begingroup
\makeatletter
\providecommand\color[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package color not loaded in conjunction with
terminal option `colourtext'%
}{See the gnuplot documentation for explanation.%
}{Either use 'blacktext' in gnuplot or load the package
color.sty in LaTeX.}%
\renewcommand\color[2][]{}%
}%
\providecommand\includegraphics[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package graphicx or graphics not loaded%
}{See the gnuplot documentation for explanation.%
}{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}%
\renewcommand\includegraphics[2][]{}%
}%
\providecommand\rotatebox[2]{#2}%
\@ifundefined{ifGPcolor}{%
\newif\ifGPcolor
\GPcolorfalse
}{}%
\@ifundefined{ifGPblacktext}{%
\newif\ifGPblacktext
\GPblacktexttrue
}{}%
% define a \g@addto@macro without @ in the name:
\let\gplgaddtomacro\g@addto@macro
% define empty templates for all commands taking text:
\gdef\gplbacktext{}%
\gdef\gplfronttext{}%
\makeatother
\ifGPblacktext
% no textcolor at all
\def\colorrgb#1{}%
\def\colorgray#1{}%
\else
% gray or color?
\ifGPcolor
\def\colorrgb#1{\color[rgb]{#1}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}%
\expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}%
\expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}%
\expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}%
\expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}%
\expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}%
\expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}%
\expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}%
\expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}%
\else
% gray
\def\colorrgb#1{\color{black}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color{black}}%
\expandafter\def\csname LT1\endcsname{\color{black}}%
\expandafter\def\csname LT2\endcsname{\color{black}}%
\expandafter\def\csname LT3\endcsname{\color{black}}%
\expandafter\def\csname LT4\endcsname{\color{black}}%
\expandafter\def\csname LT5\endcsname{\color{black}}%
\expandafter\def\csname LT6\endcsname{\color{black}}%
\expandafter\def\csname LT7\endcsname{\color{black}}%
\expandafter\def\csname LT8\endcsname{\color{black}}%
\fi
\fi
\setlength{\unitlength}{0.0500bp}%
\ifx\gptboxheight\undefined%
\newlength{\gptboxheight}%
\newlength{\gptboxwidth}%
\newsavebox{\gptboxtext}%
\fi%
\setlength{\fboxrule}{0.5pt}%
\setlength{\fboxsep}{1pt}%
\begin{picture}(7200.00,5040.00)%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%
\put(525,704){\makebox(0,0)[r]{\strut{}None}}%
\put(525,1213){\makebox(0,0)[r]{\strut{}}}%
\put(525,1722){\makebox(0,0)[r]{\strut{}}}%
\put(525,2231){\makebox(0,0)[r]{\strut{}}}%
\put(525,2740){\makebox(0,0)[r]{\strut{}Moderate}}%
\put(525,3248){\makebox(0,0)[r]{\strut{}}}%
\put(525,3757){\makebox(0,0)[r]{\strut{}}}%
\put(525,4266){\makebox(0,0)[r]{\strut{}}}%
\put(525,4775){\makebox(0,0)[r]{\strut{}High}}%
\put(720,484){\makebox(0,0){\strut{}$0$}}%
\put(1560,484){\makebox(0,0){\strut{}$10$}}%
\put(2400,484){\makebox(0,0){\strut{}$20$}}%
\put(3240,484){\makebox(0,0){\strut{}$30$}}%
\put(4079,484){\makebox(0,0){\strut{}$40$}}%
\put(4919,484){\makebox(0,0){\strut{}$50$}}%
\put(5759,484){\makebox(0,0){\strut{}$60$}}%
}%
\gplgaddtomacro\gplfronttext{%
\csname LTb\endcsname%
\put(-377,2739){\rotatebox{-270}{\makebox(0,0){\strut{}Amount of inserted energy [-]}}}%
\put(3239,154){\makebox(0,0){\strut{}Time [s]}}%
\csname LTb\endcsname%
\put(4652,1457){\makebox(0,0)[r]{\strut{}Energy insertion}}%
}%
\gplgaddtomacro\gplbacktext{%
\put(5954,704){\makebox(0,0)[l]{\strut{}$0$}}%
\put(5954,1213){\makebox(0,0)[l]{\strut{}$10$}}%
\put(5954,1722){\makebox(0,0)[l]{\strut{}$20$}}%
\put(5954,2231){\makebox(0,0)[l]{\strut{}$30$}}%
\put(5954,2740){\makebox(0,0)[l]{\strut{}$40$}}%
\put(5954,3248){\makebox(0,0)[l]{\strut{}$50$}}%
\put(5954,3757){\makebox(0,0)[l]{\strut{}$60$}}%
\put(5954,4266){\makebox(0,0)[l]{\strut{}$70$}}%
\put(5954,4775){\makebox(0,0)[l]{\strut{}$80$}}%
}%
\gplgaddtomacro\gplfronttext{%
\csname LTb\endcsname%
\put(6459,2739){\rotatebox{-270}{\makebox(0,0){\strut{}Von Mises Stress [MPa]}}}%
\csname LTb\endcsname%
\put(4652,1216){\makebox(0,0)[r]{\strut{}Von Mises Stress}}%
}%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%
\put(7010,704){\makebox(0,0)[l]{\strut{}$0$}}%
\put(7010,1213){\makebox(0,0)[l]{\strut{}$75$}}%
\put(7010,1722){\makebox(0,0)[l]{\strut{}$150$}}%
\put(7010,2231){\makebox(0,0)[l]{\strut{}$225$}}%
\put(7010,2740){\makebox(0,0)[l]{\strut{}$300$}}%
\put(7010,3248){\makebox(0,0)[l]{\strut{}$375$}}%
\put(7010,3757){\makebox(0,0)[l]{\strut{}$450$}}%
\put(7010,4266){\makebox(0,0)[l]{\strut{}$525$}}%
\put(7010,4775){\makebox(0,0)[l]{\strut{}$600$}}%
}%
\gplgaddtomacro\gplfronttext{%
\csname LTb\endcsname%
\put(7647,2739){\rotatebox{-270}{\makebox(0,0){\strut{}Temperature [$^{\circ} $C]}}}%
\csname LTb\endcsname%
\put(4652,968){\makebox(0,0)[r]{\strut{}Temperature}}%
}%
\gplbacktext
\put(0,0){\includegraphics{pictures/EPS/PowerControl}}%
\gplfronttext
\end{picture}%
\endgroup
答案1
如果输入文件\makeatletter
被吸收为另一个命令的参数,则无法完成其工作,在您的例子中是\scalebox
。如果文件被输入,情况会发生变化:类别代码不会像被吸收为参数时那样被冻结。
“解决方案”是将设置部分移到\scalebox
:之前
\begin{figure}
% GNUPLOT: LaTeX picture with Postscript
\begingroup
\makeatletter
\providecommand\color[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package color not loaded in conjunction with
terminal option `colourtext'%
}{See the gnuplot documentation for explanation.%
}{Either use 'blacktext' in gnuplot or load the package
color.sty in LaTeX.}%
\renewcommand\color[2][]{}%
}%
\providecommand\includegraphics[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package graphicx or graphics not loaded%
}{See the gnuplot documentation for explanation.%
}{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}%
\renewcommand\includegraphics[2][]{}%
}%
\providecommand\rotatebox[2]{#2}%
\@ifundefined{ifGPcolor}{%
\newif\ifGPcolor
\GPcolorfalse
}{}%
\@ifundefined{ifGPblacktext}{%
\newif\ifGPblacktext
\GPblacktexttrue
}{}%
% define a \g@addto@macro without @ in the name:
\let\gplgaddtomacro\g@addto@macro
% define empty templates for all commands taking text:
\gdef\gplbacktext{}%
\gdef\gplfronttext{}%
\makeatother
\ifGPblacktext
% no textcolor at all
\def\colorrgb#1{}%
\def\colorgray#1{}%
\else
% gray or color?
\ifGPcolor
\def\colorrgb#1{\color[rgb]{#1}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}%
\expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}%
\expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}%
\expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}%
\expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}%
\expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}%
\expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}%
\expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}%
\expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}%
\else
% gray
\def\colorrgb#1{\color{black}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color{black}}%
\expandafter\def\csname LT1\endcsname{\color{black}}%
\expandafter\def\csname LT2\endcsname{\color{black}}%
\expandafter\def\csname LT3\endcsname{\color{black}}%
\expandafter\def\csname LT4\endcsname{\color{black}}%
\expandafter\def\csname LT5\endcsname{\color{black}}%
\expandafter\def\csname LT6\endcsname{\color{black}}%
\expandafter\def\csname LT7\endcsname{\color{black}}%
\expandafter\def\csname LT8\endcsname{\color{black}}%
\fi
\fi
\setlength{\unitlength}{0.0500bp}%
\ifx\gptboxheight\undefined%
\newlength{\gptboxheight}%
\newlength{\gptboxwidth}%
\newsavebox{\gptboxtext}%
\fi%
\setlength{\fboxrule}{0.5pt}%
\setlength{\fboxsep}{1pt}%
\scalebox{scale=0.65}{% <--- don't forget
\begin{picture}(7200.00,5040.00)%
<THE REST OF THE PICTURE COMMANDS>
\end{picture}%
}% <--- matching \scalebox{
\endgroup
\end{figure}