如何将引文放入投影机的框架中?

如何将引文放入投影机的框架中?

我有一段很长的引文,想把它放入投影仪的框架中。当然,我也可以只改变字体大小,但我更喜欢一种可以自动运行并按比例重新调整同一引文环境中不同字体大小的解决方案。

需要重新缩放的引文示例:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme{Madrid}
\begin{document}
\begin{frame}
\frametitle{My quote}
\begin{quote}
Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. The last sentence of the very long quote.

{\normalfont \scriptsize (Author, \textit{Source}, pp. 11--12)}
\end{quote}
\end{frame}
\end{document}

在此处输入图片描述

我曾尝试使用 scalebox,但是当在 quote 环境中使用时,它只会将所有内容放在一行中,而当在 quote 外部使用时,它会使右边距变窄:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme{Madrid}
\begin{document}
\begin{frame}
\frametitle{My quote}
\scalebox{0.74}{
\begin{quote}
Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. The last sentence of the very long quote.

{\normalfont \scriptsize (Author, \textit{Source}, pp. 11--12)}
\end{quote}}
\end{frame}
\end{document}

在此处输入图片描述

准确地说,我希望重新缩放后的引文能够与普通引文占用相同的空间 - 即具有通常的左右边距。在示例中\scalebox,幻灯片包含整个引文,但右边距比通常应该的要大。

答案1

您可以使用 tcolorbox 的拟合库。这将自动选择合适的字体大小,以便您的文本适合您指定的高度:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme{Madrid}

\usepackage[most]{tcolorbox}

\begin{document}
\begin{frame}
\frametitle{My quote}
\tcboxfit[height=.8\textheight,frame hidden,interior hidden,enhanced]{
Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. The last sentence of the very long quote.

{\normalfont \scriptsize (Author, \textit{Source}, pp. 11--12)}
}
\end{frame}
\end{document}

答案2

要调整多行文本的大小以适应固定空间,需要多个设置¹,因为换行符取决于类型大小。

最好的办法是有一个循环,对一系列降序尺寸进行迭代,直到适合为止。

未经测试且不完整的代码:

\ExplSyntaxOn
\NewDocumentEnvironment{Quote}{+b}
  {
    \clist_map_token:nn
       {\normalsize, \footnotesize, \scriptsize, \tiny } % ❶
       {
          \vbox_set:Nn \l_tmpa_box { ##1 #1\par } % ❷
          \dim_compare:nNnT % ❸
            {\box_ht_plus_dp:N \l_tmpa_box}
               <
            {\WHATEVERTHEHEIGHTIS}
            {
              \clist_map_break:n {\box_use_drop:N \l_tmpa_box} % ❹
            }
       }
  }
  {}
\ExplSyntaxOff

这里的策略是连续尝试更小的尺寸(从❶的列表中),然后将文本设置在 vbox❷ 中,看看它是否足够短❸(我懒得去看如何检查投影仪框架中的可用垂直空间,你必须输入你自己的值,如果它足够小,则输出排版文本并跳出循环。

Quote请注意,这可能会多次执行环境中的任何宏,因此如果您有类似编号方程式的东西,可能会出现奇怪的结果。


  1. 实际上,早在 90 年代初期,我就编写了代码来实现自动瓶标排版。实际上,这有点复杂,并且包含从瓶标中删除可选文本的逻辑,如果标签上没有足够的空间容纳所有需要的内容。

答案3

我不会缩放引号。而是选择较小的字体大小并减少基线跳过。例如,正如在下一个 MWE 中所做的那样:

\documentclass[utf8]{beamer}
\usetheme{Madrid}
\usepackage[T1]{fontenc}

\begin{document}
\begin{frame}
    \frametitle{My quote}
\begin{quote}
\small\linespread{0.84}\selectfont % <----
Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. The last sentence of the very long quote.
    \end{quote}
\vspace{-0.5ex}
\scriptsize (Author, \textit{Source}, pp. 11--12)
\end{frame}
\end{document}

在此处输入图片描述

答案4

到目前为止,我发现的最好的解决方案是将引文放入环境中minipage,并将宽度设置为大于\textwidth,以补偿边距的缩小\scalebox

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme{Madrid}
\begin{document}
\begin{frame}
\frametitle{My quote}
\scalebox{0.8}{
\begin{minipage}{1.2\textwidth}
\begin{quote}
Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. Some very long quote. The last sentence of the very long quote.
{\normalfont \scriptsize (Author, \textit{Source}, pp. 11--12)}
\end{quote}
\end{minipage}
}
\end{frame}
\end{document}

在此处输入图片描述

这个解决方案并不理想,因为(1)它不是自动的(即我需要手动输入数值),(2)它将引号稍微向左移动。

相关内容