![无法在 beamerposter 中正确设置 tikzpicture 的大小](https://linux22.com/image/391719/%E6%97%A0%E6%B3%95%E5%9C%A8%20beamerposter%20%E4%B8%AD%E6%AD%A3%E7%A1%AE%E8%AE%BE%E7%BD%AE%20tikzpicture%20%E7%9A%84%E5%A4%A7%E5%B0%8F.png)
我尝试将下面提供的 TikZ 图片插入到 beamerposter 文档中。
它由以下代码生成(除了“入射光束”中间的箭头,这是一个多余的细节):
\begin{tikzpicture}
% axes and origin
\coordinate (O) at (0, 0);
\draw node[anchor=north east] {$O$};
\draw [->] (-3,0)--(3,0) node [pos=0.98, below] {$x$};
\draw [->] (0,-1)--(0,3) node [pos=0.98, left] {$z$};
% orts
\draw [thick, ->] (O)--(1,0) node[pos=1, below] {$\vc e_x$};
\draw [thick, ->] (O)--(0,1) node[pos=1, left] {$\vc e_z$};
% vector k and its angle chi
\coordinate (K) at ({2.6*sin(30)},{2.6*cos(30)});
\draw [thick, ->] (O)--(K) node[pos=1, right] {$\vc k$};
\draw ([shift=(60:0.5)] O) arc (60:90:0.5) node[pos=0.35, above] {$\chi$};
% k projections
\coordinate (Kx) at (K |- O);
\coordinate (Kz) at (K -| O);
\draw [thick, ->](O)--(Kx) node[pos=1.15, below] {$\vc k_x$};
\draw [thick, ->](O)--(Kz) node[pos=1, left] {$\vc k_z$};
\draw [dashed] (K)--(Kz);
\draw [dashed] (K)--(Kx);
% foton beam
\draw (-3, 2)--(O) node[pos=0.45, above] {$\ \hbar \omega$};
\end{tikzpicture}
\begin{block}...\end{block}
当我在 beamerposter 文档中的任何位置(在内,或者在框架内) 插入这段代码时,我得到了这个丑陋的结果(图像跨越了整个海报宽度):
平均能量损失
\documentclass[final, 24pt]{beamer}\usetheme{Frankfurt}\usecolortheme{orchid}\usefonttheme[onlymath]{serif}\mode<presentation>
\usepackage[orientation=portrait,size=a0,scale=1.4,debug]{beamerposter}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[english, russian]{babel}
\usepackage{tikz}
\newcommand{\vc}[1]{\mathbf {#1}}
\begin{document}
\begin{frame}{}
\begin{center}
\begin{tikzpicture}
% ... picture code given above
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
我如何才能让它看起来可接受?通过
\scalebox{2.2}{
\begin{tikzpicture}[scale=3]
% picture code
\end{tikzpicture}
}
然后我可以手动对线宽进行一些调整(\draw[..., line width=0.33ex]
例如)以获得合理的输出:
我想问社区是否有其他方法可以获得所需的结果(也许这是一个众所周知的问题,但我无法直接在 Google 上搜索到它)以及为什么直接从 a4 文档“移植”漂亮的图像代码会产生这样的垃圾?
答案1
欢迎使用 TeX-SE!您可以将一些指令附加到every path
和every node
样式中。以下是示例。
\documentclass[final, 24pt]{beamer}\usetheme{Frankfurt}\usecolortheme{orchid}\usefonttheme[onlymath]{serif}\mode<presentation>
\usepackage[orientation=portrait,size=a0,scale=1.4,debug]{beamerposter}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[english, russian]{babel}
\usepackage{tikz}
\newcommand{\vc}[1]{\mathbf {#1}}
\begin{document}
\begin{frame}{}
\begin{center}
\begin{tikzpicture}[scale=12,every path/.append style={
line width=4*\pgflinewidth},every node/.append style={scale=0.2,transform
shape}]
% axes and origin
\coordinate (O) at (0, 0);
\draw node[anchor=north east] {$O$};
\draw [->] (-3,0)--(3,0) node [pos=0.98, below] {$x$};
\draw [->] (0,-1)--(0,3) node [pos=0.98, left] {$z$};
% orts
\begin{scope}[thick]
\draw [->] (O)--(1,0) node[pos=1, below] {$\vc e_x$};
\draw [->] (O)--(0,1) node[pos=1, left] {$\vc e_z$};
% vector k and its angle chi
\coordinate (K) at ({2.6*sin(30)},{2.6*cos(30)});
\draw [thick, ->] (O)--(K) node[pos=1, right] {$\vc k$};
\end{scope}
\draw ([shift=(60:0.5)] O) arc (60:90:0.5) node[pos=0.35, above] {$\chi$};
% k projections
\coordinate (Kx) at (K |- O);
\coordinate (Kz) at (K -| O);
\begin{scope}[thick]
\draw [->](O)--(Kx) node[pos=1.15, below] {$\vc k_x$};
\draw [->](O)--(Kz) node[pos=1, left] {$\vc k_z$};
\end{scope}
\draw [dashed] (K)--(Kz);
\draw [dashed] (K)--(Kx);
% foton beam
\draw (-3, 2)--(O) node[pos=0.45, above] {$\ \hbar \omega$};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
当然,我不知道您最喜欢什么,但您可以根据需要调整比例。
编辑:修复了箭头。因为 Ti钾Z 解析路径,最简单的选项是通过范围设置线宽。