投影仪幻灯片中的连字功能如何以及何时起作用?

投影仪幻灯片中的连字功能如何以及何时起作用?

我不明白如何beamer处理连字符。请考虑以下示例:

\documentclass{beamer}
\begin{document}

\begin{frame}
\frametitle{Without hyphenation}
Latex is the stable dispersion (emulsion) of polymer microparticles in an aqueous medium. Latexes may be natural or synthetic. Latex as found in nature is a milky fluid found in 10\% of all flowering plants (angiosperms). It is a complex emulsion consisting of proteins, alkaloids, starches, sugars, oils, tannins, resins, and gums that coagulates on exposure to air. It is usually exuded after tissue injury. In most plants, latex is white, but some have yellow, orange, or scarlet latex. Since the 17th century, latex has been used as a term for the fluid substance in plants. It serves mainly as defense against herbivorous insects.
\end{frame}

\begin{frame}
\frametitle{With hyphenation}
\begin{overprint}
\onslide<1>
Latex is the stable dispersion (emulsion) of polymer microparticles in an aqueous medium. Latexes may be natural or synthetic. Latex as found in nature is a milky fluid found in 10\% of all flowering plants (angiosperms). It is a complex emulsion consisting of proteins, alkaloids, starches, sugars, oils, tannins, resins, and gums that coagulates on exposure to air. It is usually exuded after tissue injury. In most plants, latex is white, but some have yellow, orange, or scarlet latex. Since the 17th century, latex has been used as a term for the fluid substance in plants. It serves mainly as defense against herbivorous insects.
\end{overprint}
\end{frame}

\end{document}

在第一张幻灯片中,文本不会被连字符连接,而在第二张幻灯片中则会被连字符连接。如何在没有overprint块的幻灯片上实现连字符连接?

答案1

第一张幻灯片上的文本似乎使用了\raggedright(或beamer与之相当的)禁止连字的符号。第二张幻灯片上的文本使用了\onslide内部使用的符号,minipage这反过来又会导致文本排版对齐,从而允许连字。;-)

如果您希望两张幻灯片都使用右侧不规则文本和连字符,请在序言中添加以下内容:

\usepackage{ragged2e}
\RaggedRight

\makeatletter
\def\@minipagerestore{\RaggedRight}
\makeatother

另一方面,如果您希望两张幻灯片都有对齐的文本,则以下序言代码可以解决问题:

\usepackage{ragged2e}
\justifying

答案2

这看起来不像是该类的预期行为beamer,但它是由不同的值引起的。在第一张幻灯片上或第二个文件中的命令之前\rightskip放置(在日志文件中)显示该值为\showthe\rightskip\onslide

> 0.0pt plus 1.0fil.

\onslide<1>这会阻止使用连字符,而倾向于使用\rightskip不规则的右侧文本。另一方面,在第二张幻灯片中,

> 0.0pt.

因此文本现在设置为与(左)右边距对齐,并使用连字符。

要使第一帧中的文本对齐并带有连字符,您需要\rightskip在帧开始之前进行设置。您可以放入\setlength{\rightskip}{0pt}前言以影响所有帧。如果您只希望第一帧像这样,那么您可以将设置放在包含该帧的组中,如下例所示,我们可以看到第一帧的连字符生效,第二帧的开头处不齐,然后在 之后连字符\onframe。第三张幻灯片显示了相反的效果,通过将填充重新添加到\rightskip以在 之后重新获得不齐的效果\onslide

\documentclass{beamer}
\begin{document}

\bgroup
\setlength{\rightskip}{0pt}

\begin{frame}
  \frametitle{With hyphenation} 

  Latex is the stable dispersion (emulsion) of polymer microparticles
  in an aqueous medium. Latexes may be natural or synthetic. Latex as
  found in nature is a milky fluid found in 10\% of all flowering
  plants (angiosperms). It is a complex emulsion consisting of
  proteins, alkaloids, starches, sugars, oils, tannins, resins, and
  gums that coagulates on exposure to air. It is usually exuded after
  tissue injury. In most plants, latex is white, but some have yellow,
  orange, or scarlet latex. Since the 17th century, latex has been
  used as a term for the fluid substance in plants. It serves mainly
  as defense against herbivorous insects.
\end{frame}
\egroup

\begin{frame}
\frametitle{With and without hyphenation}
\begin{overprint}
  Latex is the stable dispersion (emulsion) of polymer
  microparticles in an aqueous medium. Latexes may be natural or
  synthetic. Latex as found in nature is a milky fluid found in 10\%
  of all flowering plants (angiosperms). It is a complex emulsion
  consisting of proteins, alkaloids, starches, sugars, oils, tannins,
  resins, and gums that coagulates on exposure to air. It is usually
  exuded after tissue injury.
  \onslide<1> Latex is the stable dispersion (emulsion) of polymer
  microparticles in an aqueous medium. Latexes may be natural or
  synthetic. Latex as found in nature is a milky fluid found in 10\%
  of all flowering plants (angiosperms). It is a complex emulsion
  consisting of proteins, alkaloids, starches, sugars, oils, tannins,
  resins, and gums that coagulates on exposure to air. It is usually
  exuded after tissue injury. In most plants, latex is white, but some
  have yellow, orange, or scarlet latex. Since the 17th century, latex
  has been used as a term for the fluid substance in plants. It serves
  mainly as defense against herbivorous insects.
\end{overprint}
\end{frame}

\begin{frame}
\frametitle{Without hyphenation}
\begin{overprint}
Latex is the stable dispersion (emulsion) of polymer
  microparticles in an aqueous medium. Latexes may be natural or
  synthetic. Latex as found in nature is a milky fluid found in 10\%
  of all flowering plants (angiosperms). It is a complex emulsion
  consisting of proteins, alkaloids, starches, sugars, oils, tannins,
  resins, and gums that coagulates on exposure to air. It is usually
  exuded after tissue injury.
  \onslide<1> \setlength{\rightskip}{0pt plus 1fil}Latex is the stable
  dispersion (emulsion) of polymer 
  microparticles in an aqueous medium. Latexes may be natural or
  synthetic. Latex as found in nature is a milky fluid found in 10\%
  of all flowering plants (angiosperms). It is a complex emulsion
  consisting of proteins, alkaloids, starches, sugars, oils, tannins,
  resins, and gums that coagulates on exposure to air. It is usually
  exuded after tissue injury. In most plants, latex is white, but some
  have yellow, orange, or scarlet latex. Since the 17th century, latex
  has been used as a term for the fluid substance in plants. It serves
  mainly as defense against herbivorous insects.
\end{overprint}
\end{frame}

\end{document}

第 1 帧 第 2 帧和第 3 帧

相关内容