LaTeX 无法正确连字,文本超出页面范围

LaTeX 无法正确连字,文本超出页面范围

我遇到了 LaTeX 无法连字符的问题$\beta$-galactosidase,结果单词跑到页面外面了。

我已经将问题缩小到特定软件包,因为没有软件包的最低限度的 LaTeX 前言可以避免这个问题。请帮助我通过排除法识别有问题的软件包,并建议一个尽可能保留该软件包使用的解决方案。

\documentclass[a4paper,12pt]{article}

\usepackage[a4paper]{geometry}

\begin{document}
Finally, all of the three antibiotics examined had a negative effect on $\beta$-galactosidase activity from the time they were introduced to the assay.  It is to be noted that chloramphenicol interferes with the 50S ribosomal subunit which negatively implicates peptide bond formation~\cite{chloram1962}, streptomycin interrupts the initiation stage of protein synthesis~\cite{strepto1968}, while rifampicin is an RNA-polymerase inhibitor~\cite{rifam1983}.  These results verify that both transcription and translation are needed for the gene product $\beta$-galactosidase to arise, which is probably not much more than a validation of the flow of genetic information in accordance with central dogma.  An interruption at the transcription or translational stage would prematurely or directly halt the production of $\beta$-galactosidase, in the two respective cases.
\end{document}

示例输出:

在此处输入图片描述

答案1

问题是 TeX 不知道如何对单词进行连字符连接,$\beta$-galactosidase因为单词$\beta$-上附加了 。解决这个问题的最佳方法是加载hyphenat包,并使用\hyp{}而不是-

\usepackage{hyphenat}
$\beta$\hyp{}galactosidase

这告诉连字器将后面的单词连字\hyp{}为常规单词。

答案2

其他人已经指出了这个问题(\beta$-)。我想指出化学家的答案:bpchem。它包含\IUPAC宏,其中\|有一个断点和\-一个可断开的连字符。这给出

\documentclass[a4paper,12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage{bpchem,upgreek}

\begin{document}

Finally, all of the three antibiotics examined had a negative effect on
\IUPAC{$\upbeta$-galacto\|sidase} activity from the time they were introduced to
the assay. It is to be noted that chloramphenicol interferes with the 50S
ribosomal subunit which negatively implicates peptide bond
formation~\cite{chloram1962}, streptomycin interrupts the initiation stage of
protein synthesis~\cite{strepto1968}, while rifampicin is an RNA-polymerase
inhibitor~\cite{rifam1983}. These results verify that both transcription and
translation are needed for the gene product $\upbeta$-galactosidase to arise,
which is probably not much more than a validation of the flow of genetic
information in accordance with central dogma. An interruption at the
transcription or translational stage would prematurely or directly halt the
production of $\upbeta$-galactosidase, in the two respective cases.

\end{document}

(我在本文中upgreek使用了斜体等,这是错误的,但在文献中经常看到,因为排版是在 TeX 中完成的,而直立的希腊字母需要一点工作!)\beta

答案3

值得一提的是,ConTeXt MkIV 可以正确地用 连接单词-。我不知道内部实现,但如果 lualatex 具有类似的功能就好了。

这是一个最小的例子

\setupindenting[big,yes] % to get the same visual effect
\starttext
Finally, all of the three antibiotics examined had a negative effect on $\beta$-galactosidase activity from the time they were introduced to the assay.`
\stoptext

这使

在此处输入图片描述

关于约瑟夫使用 \upbeta 的建议,如果您使用包含希腊字母的文本字体(例如 xits 或 cambria),您只需输入β-galactosidase,ConTeXt 就会正确地将单词连字符化。

答案4

如果一个单词已经连字符,TeX 不会将其连字符化。这里有一个解决方案

\documentclass[a4paper,12pt]{article}

\usepackage{geometry}

\usepackage{hyphenat}
\hyphenation{ga-lac-to-si-dase}
\def\hyph{-\penalty0\hskip0pt\relax}

\begin{document}
Finally, all of the three antibiotics examined had a negative effect on $\beta$\hyph galactosidase activity from the time they were introduced to the assay.  It is to be noted that chloramphenicol interferes with the 50S ribosomal subunit which negatively implicates peptide .  
\end{document}

这更像是 MWE。如果你把连字符放回去,你就可以重现错误。如果你经常使用它,最好为此定义一个命令:

\newcommand{\BetaGalactosidase}{$\beta$\hyph galactosidase}%

这是基于https://stackoverflow.com/questions/2193307/how-to-get-latex-to-hyphenate-a-word-that-c​​ontains-a-dash

相关内容