我想使用该standalone
包在投影仪演示文稿中包含一个 TikZ 图片,并且我希望图片中的文本和框架其余部分的大小一致。
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\beamertemplatenavigationsymbolsempty
\usepackage{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}
\begin{document}
\begin{frame}[plain]{A frame}
\includestandalone[mode=tex,height=0.4\textwidth,keepaspectratio]{pic}
At some time $t$ there is a $\pi$ pulse along $z$\dots
{\footnotesize This is some small text.}
\end{frame}
\end{document}
这是pic.tex
:
\documentclass[beamer]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}
\begin{document}
\begin{tikzpicture}[
scale=0.5,
wave/.style={decorate, decoration={snake,amplitude=0.6mm,segment length=2mm,post length=1.3mm}, ->, thick,->,>=stealth},
coordaxis/.style={->}
]
\draw[coordaxis] (0,0) -- +(1.5,0) node[midway,below] {\footnotesize $t$};
\draw[coordaxis] (0,0) -- +(0,1.5) node[midway,left] {\footnotesize $z$};
\draw[wave] (2,2) -- +(0,2) node[midway, right] {$\pi$};
\end{tikzpicture}
\end{document}
如您所见,字体大小不一致,即正常和脚注大小的符号在图片和框架中的其余文本中的大小不同。我怎样才能使字体大小一致?
编辑:此外,编译 TeXLive 时会抛出一个我不知道如何解释的警告:
/usr/share/texmf-dist/tex/latex/standalone/standalone.sty:259: File stack underflow! on input line 259.
./presentation.tex:8: File stack underflow! on line 8.
答案1
如果您希望字体大小统一,则必须删除可选参数\includestandalone[mode=tex,height=0.4\textwidth,keepaspectratio]{pic}
。通过指定,height=0.4\textwidth,keepaspectratio
您实际上是在放大图像,正如 Steven 所说。此外,我已使用键font
来声明normalsize
字体。如果需要,请更改它。
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\beamertemplatenavigationsymbolsempty
\usepackage{standalone}
\usepackage{filecontents}
\begin{filecontents*}{pic.tex}
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}
\begin{document}
\begin{tikzpicture}[
scale=0.5,
wave/.style={decorate, decoration={snake,amplitude=0.6mm,segment length=2mm,post length=1.3mm}, ->, thick,->,>=stealth},
coordaxis/.style={->}
]
\draw[coordaxis] (0,0) -- +(1.5,0) node[midway,below,font=\normalsize] {$t$}; %% font key here
\draw[coordaxis] (0,0) -- +(0,1.5) node[midway,left,font=\normalsize] {$z$}; %% font key here
\draw[wave] (2,2) -- +(0,2) node[midway, right,font=\normalsize] {$\pi$}; %% font key here
\end{tikzpicture}
\end{document}
\end{filecontents*}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}
\begin{document}
\begin{frame}[plain]{A frame}
\includestandalone{pic}
At some time $t$ there is a $\pi$ pulse along $z$\dots
{\footnotesize This is some small text.}
\end{frame}
\end{document}
另一方面,如果您想要具有正常字体大小的更大图像,只需更改坐标即可tikzpicture
:
\draw[coordaxis] (0,0) -- +(6.5,0)...