如何防止 \raggedright 删除 \parshape 的左缩进?

如何防止 \raggedright 删除 \parshape 的左缩进?

\raggedright当为 指定较大的缩进时,的输出看起来不错\parshape,但\raggedright会吃掉较小的缩进。

如果一个单词不适合一行,有没有办法防止连字符并将整个单词移动到下一行而不触及指定的段落缩进(我认为\raggedright会这样做)\parshape

\documentclass[varwidth]{standalone}
\begin{document}
  \parbox{40mm}
    { \parshape 3 0pt 113.81102pt 14.44pt 99.37102pt 17.77pt 96.04102pt
      \raggedright % comment this line to see the difference
      % \tolerance 0 % uncomment this line when \raggedright is commented
      \textbullet\ This is sentence 1.\\This is sentence 2.
      This is sentence 3.
    }
\end{document}

\raggedright(保留缩进,但字间间距过大):

\raggedright没有过多的词间间距,但缩进被破坏):

\raggedright,但\tolerance 0这次字间距太窄,字母溢出s;我需要这个词自动移至下一行):

答案1

\raggedright重新定义\\:它在内部插入 a \par,因此实际上结束了 \parshape。您可以使用 \newline 代替\\

\documentclass[varwidth]{standalone}

\begin{document}
 \parbox{40mm}
    { \parshape 3 0pt 113.81102pt 14.44pt 99.37102pt 17.77pt 96.04102pt
      \raggedright 
      \textbullet\ This is sentence 1 \newline This is sentence 2
      This is sentence 3
    }

\end{document}

在此处输入图片描述

或者设置\rightskip

\documentclass[varwidth]{standalone}

\begin{document}
 \parbox{40mm}
    { \parshape 3 0pt 113.81102pt 14.44pt 99.37102pt 17.77pt 96.04102pt
      \rightskip 0pt plus 1fil
      \textbullet\ This is sentence 1 \\ This is sentence 2
      This is sentence 3
    }

\end{document}

相关内容