如何用可變空間大小替換連字符?

如何用可變空間大小替換連字符?

我已經尋找這個問題的答案太久了。我嘗試過不同的連字符命令和包,但它們似乎不起作用。

我的問題是我用芬蘭語編寫文本,而 LaTeX 在其中產生了很多連字符。芬蘭語作為一種語言有很多很長的單詞,所以你可以想像文本在最糟糕的情況下會是什麼樣子。是否可以停用連字符並使用可變空​​間大小自動填充其餘內容? Word 似乎有能力做到這一點。

我可以接受連字符,但我忍不住想知道應該有一個簡單的解決方案來解決這樣的問題。我目前正在使用以下軟體包:

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[finnish]{babel}
\usepackage{array}
\usepackage{hyperref}

編輯:我會澄清一下:我不介意生成的空間之間是否有很大差異。我只是想要一種用可變空間大小替換連字符的方法,而不需要對文字進行重大修改。

答案1

如果您願意接受非常糟糕的排版,那麼避免連字並不困難。

在範例中我使用兩列格式來強調效果:

\documentclass[12pt,twocolumn]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[finnish]{babel}

\begin{document}

Helsinki on Suomen pääkaupunki ja Uudenmaan maakuntakeskus.
Se sijaitsee Suomenlahden pohjoisrannalla Uudenmaan maakunnan
keskiosassa. Helsingin naapurikunnat ovat lännessä Espoo,
pohjoisessa Vantaa ja idässä Sipoo. Kaupungissa on 642\,045
asukasta. Helsingin keskustaajama ulottuu usean naapurikunnan
alueelle. Laajemmalla Helsingin seudun metropolialueella on
1\,456\,619 asukasta.

\hyphenpenalty=10000 \spaceskip=0.3em plus 4em minus 0.2em

Helsinki on Suomen pääkaupunki ja Uudenmaan maakuntakeskus.
Se sijaitsee Suomenlahden pohjoisrannalla Uudenmaan maakunnan
keskiosassa. Helsingin naapurikunnat ovat lännessä Espoo,
pohjoisessa Vantaa ja idässä Sipoo. Kaupungissa on 642\,045
asukasta. Helsingin keskustaajama ulottuu usean naapurikunnan
alueelle. Laajemmalla Helsingin seudun metropolialueella on
1\,456\,619 asukasta.

\end{document}

在此輸入影像描述

一欄格式相同。

在此輸入影像描述

我不知道為什麼你不想要連字號:幾個世紀以來它一直是一種常見的印刷設備。

答案2

TeX 有許多參數,您可以使用它們來控制拉伸空間和連字符的相對需求。 LaTeX 具有預設配置,\fussy並且\sloppy.您可能會對允許更多空間拉伸的設置感到滿意\sloppy,但下面的示例顯示了另外兩個“甚至更草率”的設置,這些設置增加了連字的懲罰。

在此輸入影像描述

\documentclass{article}


\def\test{%
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious
It's Supercalifragilisticexpialidocious!
Even though the sound of it
Is something quite atrocious

}

\begin{document}

{\test}

{\sloppy
\test
}

{\sloppy\hyphenpenalty=1000 \emergencystretch10em
\test}

{\sloppy\hyphenpenalty=10000 \emergencystretch\textwidth
\test}

\end{document}

相關內容