使用以下代码
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.8, transform shape]
\node[draw, trapezium, red, rotate=-90, trapezium stretches body, text width=3cm, align=center] at (0,0) {\rotatebox{90}{Investment}};
\end{tikzpicture}
\end{frame}
\end{document}
如何在不改变梯形尺寸的情况下在梯形内插入三行文本。
答案1
之前和之后:
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz,stackengine}
\setstackEOL{\\}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.8, transform shape]
\node[draw, trapezium, red, rotate=-90, trapezium stretches body,
text width=3cm, align=center] at (0,0) {\rotatebox{90}{Investment}};
\end{tikzpicture}
\begin{tikzpicture}[scale=.8, transform shape]
\node[draw, trapezium, red, rotate=-90, trapezium stretches body,
text width=3cm, align=center] at (0,0) {\rotatebox{90}{%
\color{red}\Centerstack{My\\Big\\Investment}}};
\end{tikzpicture}
\end{frame}
\end{document}
这是一个没有附加包的版本,使用了\parbox
。然而,结果对\parbox
宽度极其敏感,这里精确地选择了 1.75cm:
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.8, transform shape]
\node[draw, trapezium, red, rotate=-90, trapezium stretches body,
text width=3cm, align=center] at (0,0) {\rotatebox{90}{Investment}};
\end{tikzpicture}
\begin{tikzpicture}[scale=.8, transform shape]
\node[draw, trapezium, red, rotate=-90, trapezium stretches body,
text width=3cm, align=center] at (0,0) {\rotatebox{90}{%
\parbox{1.75cm}{\centering My\\Big\\Investment}}};
\end{tikzpicture}
\end{frame}
\end{document}
答案2
shape border rotate
我只需旋转边框,而不是先旋转整个边框,然后再将文本旋转回去。(请注意,当不使用时,必须输入一些违反直觉的值,shape uses incircle
因为会发生一些奇怪的舍入。)
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.8, transform shape]
\node[draw, trapezium, red, rotate=-90, trapezium stretches body, text width=3cm,
align=center] at (0,0) {\rotatebox{90}{Investment}};
\end{tikzpicture}
\quad
\begin{tikzpicture}[scale=.8, transform shape]
\node[draw, trapezium, red,minimum width=5.5cm,
shape border rotate=-135, trapezium stretches body,
align=center] at (0,0) {Investment\\ Ducks\\ Latex};
\end{tikzpicture}
\end{frame}
\end{document}