![如果跨度超过 x 厘米,则自动断线](https://linux22.com/image/322460/%E5%A6%82%E6%9E%9C%E8%B7%A8%E5%BA%A6%E8%B6%85%E8%BF%87%20x%20%E5%8E%98%E7%B1%B3%EF%BC%8C%E5%88%99%E8%87%AA%E5%8A%A8%E6%96%AD%E7%BA%BF.png)
我在用鬣蜥特克斯将乳胶文本和方程式插入 PowerPoint 演示文稿。
该插件使用默认模板来生成乳胶图像(它将其编译为pdf然后编译为图像)。
以下是产生上述内容的输入:
\documentclass{article}
\usepackage{amsmath}
\usepackage[parfill]{parskip}
\pagestyle{empty}
\usepackage{xcolor}
\usepackage{color}
\definecolor{mywhite}{rgb}{1,1,1}
\definecolor{myblue}{RGB}{153,255,255}
\color{mywhite}
\begin{document}
\begin{itemize}
\item
A compression technique used to reduce the bits needed\\
to encode symbols (e.g. letters).
\item
Based on the frequency of occurrence of a symbol in the data.
\item
Huffman code is optimal.
\begin{itemize}
\item To use our definitions and notations, given a text\\
containing $n$ different letters where $w_i$ is the frequency\\
of the $i$’th letter, Huffman Algorithm constructs\\
an Extended Binary Tree while minimizing $\sum_{i=1}^n w_il_i$.
\end{itemize}
\end{itemize}
\end{document}
请注意,我必须手动添加\\
合适的行来换行。这真的很烦人,也很耗时。我希望以某种方式自动完成。
换句话说,我问的是:
我希望每当添加一个单词导致行跨度超过 x 厘米时,行就会自动换行。这可能吗?
答案1
您可以textwidth
使用包 定义 以具有特定值geometry
。或者,可以使用 parbox,但它们不能跨页拆分。用于\raggedright
获取非对齐文本。
\documentclass{article}
\usepackage{amsmath}
\usepackage[parfill]{parskip}
\pagestyle{empty}
\usepackage{xcolor}
\definecolor{mywhite}{rgb}{1,1,1}
\definecolor{myblue}{RGB}{153,255,255}
%\color{mywhite}
\usepackage{geometry}
\geometry{textwidth=10cm}
\begin{document}
\raggedright
\begin{itemize}
\item
A compression technique used to reduce the bits needed
to encode symbols (e.g. letters).
\item
Based on the frequency of occurrence of a symbol in the data.
\item
Huffman code is optimal.
\begin{itemize}
\item To use our definitions and notations, given a text
containing $n$ different letters where $w_i$ is the frequency
of the $i$’th letter, Huffman Algorithm constructs
an Extended Binary Tree while minimizing $\sum_{i=1}^n w_il_i$.
\end{itemize}
\end{itemize}
\end{document}