如果跨度超过 x 厘米,则自动断线

如果跨度超过 x 厘米,则自动断线

我在用鬣蜥特克斯将乳胶文本和方程式插入 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获取非对齐文本。

非常疲倦NarrowTextwidth

\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}

相关内容