ragged2e로 하이픈 최소화

ragged2e로 하이픈 최소화

\RaggedRightLaTeX에 대한 거의 모든 가이드는 내장 ragged2e\raggedright. 하지만 나는 항상 하이픈으로 연결된 단어가 너무 많아서 좌절감을 느꼈습니다 \RaggedRight. 나는 일부를 얻을 것이라는 것을 이해 \raggedright하지만(아무 것도 제공하지 않는 경우) 너무 많이 얻습니다.

나는 완전 양쪽 맞춤과 비교하기로 결정했고 \RaggedRight, 완전 양쪽 맞춤보다 하이픈이 더 많이 나오는 것을 일관되게 발견했는데 \RaggedRight, 이는 예상하지 못한 일이었습니다. 아래 예에서는 전체 정렬이 포함된 하이픈 연결이 하나만 표시되지만(이는 를 해결하기 위해 수동으로 생성된 하이픈 연결 지점에만 해당 overfull \hbox) \RaggedRight. (텍스트는 공개 도메인인 Moby Dick에서 가져온 것입니다.)

\RaggedRight완전한 정당화를 통해 얻은 것과 비교할 수 있도록 하이픈 연결을 줄일 수 있습니까 ?

\documentclass{article}
\usepackage[textwidth=4.0in]{geometry}
\usepackage{ragged2e}

% 1 hyphenated word with no ragged right
% 7 hyphenated words with \RaggedRight from ragged2e

\begin{document}
\RaggedRight
Call me Ishmael. Some years ago---never mind how long
precise\-ly---having little or no money in my purse, and nothing
particular to interest me on shore, I thought I would sail about a
little and see the watery part of the world. It is a way I have of
driving off the spleen and regulating the circulation. Whenever I
find myself growing grim about the mouth; whenever it is a damp,
drizzly November in my soul; whenever I find myself involuntarily
pausing before coffin warehouses, and bringing up the rear of
every funeral I meet; and especially whenever my hypos get such an
upper hand of me, that it requires a strong moral principle to
prevent me from deliberately stepping into the street, and
methodically knocking people's hats off---then, I account it high
time to get to sea as soon as I can. This is my substitute for
pistol and ball. With a philosophical flourish Cato throws himself
upon his sword; I quietly take to the ship. There is nothing
surprising in this. If they but knew it, almost all men in their
degree, some time or other, cherish very nearly the same feelings
towards the ocean with me.
\end{document}

답변1

줄 바꿈에 대한 몇 가지 단어입니다. TeX는 접착제가 늘어나는 정도에 따라 각 라인에 불량을 할당합니다. 울퉁불퉁한 오른쪽 설정에서는 오른쪽에 신축성 있는 접착제만 있습니다( \rightskip). 이로 인해 이 접착제(유한한 경우)는 일반적으로 명시된 것보다 더 많이 늘어납니다. 기본값은 \RaggedRight최대 2em의 "최적" 확장을 갖지만 선이 오른쪽 여백 근처에 도달하지 못할 가능성이 높으므로 불량이 높을 것으로 예상됩니다. 기본값이 \hyphenpenalty50이면 TeX는 총 단점을 최소화하기 위해 하이픈을 넣어 마진에 가까워지는 것이 더 저렴하다는 것을 알게 될 것입니다.

하이픈 연결을 덜 편리하게 만들면 글루 스트레칭이 하이픈 연결보다 전체 단점에 더 가벼운 영향을 미칠 것입니다.

표준 \raggedright설정에서는 하이픈 넣기가 절대 발생하지 않습니다(음, 거의 발생하지 않음). \rightskip무한한 늘이기( 0pt plus 1fil)가 있기 때문에 줄의 불량률이 0이 되고 단점은 에서만 추가되므로 \linepenaltyTeX는 줄 수를 최소화합니다.

좋은 절충안을 찾는 것은 쉽지 않습니다. 스트레칭을 늘리면 \rightskipTeX가 더 짧은 줄을 설정하도록 만들 수도 있습니다. \hyphenpenalty대신에 microtype나는 일반적으로 단락 설정에 꽤 좋은 영향을 미치는 를 늘릴 것을 제안합니다 .

\documentclass{article}
\usepackage[textwidth=4.0in]{geometry}
\usepackage{microtype}
\usepackage{ragged2e}

\begin{document}
\newcommand\incipit{Call me Ishmael. Some years ago---never mind how long
precise\-ly---having little or no money in my purse, and nothing
particular to interest me on shore, I thought I would sail about a
little and see the watery part of the world. It is a way I have of
driving off the spleen and regulating the circulation. Whenever I
find myself growing grim about the mouth; whenever it is a damp,
drizzly November in my soul; whenever I find myself involuntarily
pausing before coffin warehouses, and bringing up the rear of
every funeral I meet; and especially whenever my hypos get such an
upper hand of me, that it requires a strong moral principle to
prevent me from deliberately stepping into the street, and
methodically knocking people's hats off---then, I account it high
time to get to sea as soon as I can. This is my substitute for
pistol and ball. With a philosophical flourish Cato throws himself
upon his sword; I quietly take to the ship. There is nothing
surprising in this. If they but knew it, almost all men in their
degree, some time or other, cherish very nearly the same feelings
towards the ocean with me.}

\RaggedRight

\noindent With \texttt{microtype}

\bigskip

\noindent\texttt{\string\hyphenpenalty=50}

\incipit

\bigskip

\noindent\texttt{\string\hyphenpenalty=500}

\hyphenpenalty=500

\incipit

\end{document}

여기에 이미지 설명을 입력하세요

결과: 기본 하이픈 페널티를 사용하면 세 단어에 하이픈이 연결됩니다. 하이픈 페널티가 증가하면 단 하나입니다.

없이도 마찬가지microtype

여기에 이미지 설명을 입력하세요

결과: 기본 하이픈 페널티를 사용하면 7개 단어에 하이픈이 연결됩니다. 하이픈 페널티가 증가하면 단 두 개가 됩니다.

precisely모든 경우에 em-대시 때문에 하이픈은 피할 수 없습니다.

답변2

의 "불규칙함"은 TeX가 단락을 나눌 때 줄의 오른쪽 끝에 삽입되는 \RaggedRightlength 로 구성할 수 있습니다 . \RaggedRightRightskip기본값은 이며 0pt plus 2em, 이는 오른쪽에 최대 2em 공백을 포함하여 줄이 가득 차거나 짧을 수 있음을 의미합니다.

값을 늘리면 2.8em단락 오른쪽이 더 울퉁불퉁해지는 대신 하이픈 수를 하나로 줄입니다.

\documentclass{article}
\usepackage[textwidth=4.0in]{geometry}
\usepackage{ragged2e}

\setlength{\RaggedRightRightskip}{0pt plus 2.8em}

\begin{document}
\RaggedRight
Call me Ishmael. Some years ago---never mind how long
precise\-ly---having little or no money in my purse, and nothing
particular to interest me on shore, I thought I would sail about a
little and see the watery part of the world. It is a way I have of
driving off the spleen and regulating the circulation. Whenever I
find myself growing grim about the mouth; whenever it is a damp,
drizzly November in my soul; whenever I find myself involuntarily
pausing before coffin warehouses, and bringing up the rear of
every funeral I meet; and especially whenever my hypos get such an
upper hand of me, that it requires a strong moral principle to
prevent me from deliberately stepping into the street, and
methodically knocking people's hats off---then, I account it high
time to get to sea as soon as I can. This is my substitute for
pistol and ball. With a philosophical flourish Cato throws himself
upon his sword; I quietly take to the ship. There is nothing
surprising in this. If they but knew it, almost all men in their
degree, some time or other, cherish very nearly the same feelings
towards the ocean with me.
\end{document}

결과

관련 정보