![字体自动换行失败](https://linux22.com/image/321083/%E5%AD%97%E4%BD%93%E8%87%AA%E5%8A%A8%E6%8D%A2%E8%A1%8C%E5%A4%B1%E8%B4%A5.png)
当我使用
\usepackage[T1]{fontenc}%A typewriter font.
\renewcommand*\familydefault{\ttdefault}
在序言中,而不是默认字体,漂亮的自动换行功能不再起作用,文字会随意地从页面上消失。我可以使用一些选项/包来让 LaTeX 恢复正常行为吗?
有什么想法吗?
答案1
文本未对齐、未加连字符且未设置右对齐:
\documentclass{article}
\usepackage[T1]{fontenc}%A typewriter font.
\renewcommand*\familydefault{\ttdefault}
\setbox0\hbox{\texttt{ }}
\dimen0=\wd0
\setlength\textwidth{50\dimen0}
\begin{document}
\bigskip\hrule\bigskip
in the preamble instead of the default font, the beautiful
word-wrapping that happens no longer works and words just go off the
page willy-nilly. Is there some option/package I can use to return
LaTeX to normal behaviour?
\bigskip\hrule\bigskip
{\hyphenchar\font`\- \hyphenation{th-e w-o-r-k-s th-ere l-a-t-e-x}\lefthyphenmin=0 \righthyphenmin=0
in the preamble instead of the default font, the beautiful
word-wrapping that happens no longer works and words just go off the
page willy-nilly.\\ Is there some option/package I can use to return
LaTeX to normal behaviour?
}
\bigskip\hrule\bigskip
{\raggedright
in the preamble instead of the default font, the beautiful
word-wrapping that happens no longer works and words just go off the
page willy-nilly. Is there some option/package I can use to return
LaTeX to normal behaviour?
}
\bigskip\hrule\bigskip
\end{document}