![在 Beamer 中对齐文本和绘图](https://linux22.com/image/307745/%E5%9C%A8%20Beamer%20%E4%B8%AD%E5%AF%B9%E9%BD%90%E6%96%87%E6%9C%AC%E5%92%8C%E7%BB%98%E5%9B%BE.png)
我第一次使用 beamer 做演示。请参阅以下代码。
\documentclass{beamer}
\mode<presentation>
{
\usetheme{Warsaw}
\setbeamercovered{transparent}
}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{epic}
\usepackage{times}
\usepackage[T1]{fontenc}
\begin{document}
\section{}
\subsection{}
\begin{frame}
\setlength{\unitlength}{0.8cm}
\begin{picture}(12,4)
\put(0,-1){\vector(0,1){5}}
\put(0,-1){\vector(1,0){5}}
\put(0.7,-0.5){\line(1,1){4}}
\put(0.5,3.5){\line(6,-5){4.5}}
\put(0,1.6){\line(1,0){2.8}}
\dashline{0.2}(0,3)(4.2,3)
\put(-0.6,2.8){$e_1$}
\end{picture}
Hello! Here is the text. This is an additional sentence added to the text to see the output.
\end{frame}
\end{document}
您可以使用 sharelatex 查看输出。绘图很好。但我希望文本在图片右侧对齐。有什么建议吗?
答案1
您可以将图形和文本分布在两列中:
\documentclass{beamer}
\mode<presentation>
{
\usetheme{Warsaw}
\setbeamercovered{transparent}
}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{epic}
\usepackage{times}
\usepackage[T1]{fontenc}
\begin{document}
\section{}
\subsection{}
\begin{frame}
\begin{columns}[onlytextwidth]
\column[T]{.5\linewidth}
\setlength{\unitlength}{0.8cm}
\begin{picture}(12,4)
\put(0,-1){\vector(0,1){5}}
\put(0,-1){\vector(1,0){5}}
\put(0.7,-0.5){\line(1,1){4}}
\put(0.5,3.5){\line(6,-5){4.5}}
\put(0,1.6){\line(1,0){2.8}}
\dashline{0.2}(0,3)(4.2,3)
\put(-0.6,2.8){$e_1$}
\end{picture}
\column[T]{.5\linewidth}
Hello! Here is the text. This is an additional sentence added to the text to see the output.
\end{columns}
\end{frame}
\end{document}