Dealing with slightly overfull hbox's
Generally, how do you deal with lines that are slightly overhung, when microtypography is already enabled, and there's no way of hyphenating the hanging word and no desire to put it on the next line, leaving ugly whitespaces (especially if the word on the first line of the paragraph)?
Here's an example with two hanging words:
I can think of two ways out:
- Margin tweaking: I make line width slightly larger.
- Negative tracking: I decrease letterspacing in the relevant line.
Are there any other methods within given constrains? Which one is a better practice?
EDIT: I was able to implement the negative tracking in ConTeXt with kerncharacters
command, and it looks quite nice:
% ConTeXt code
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=quality]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
starttext
{ kerncharacters[-0.02] Здесь будет длинный-предлинный текст, mbox{в~коем}} никак нельзя перенести строку.
Запрещено {kerncharacters[-0.01] разрывать телефонные номера, например, mbox{(000)1234-5678}}, многозначные числа и дефисные написания.
stoptext
line-breaking typography context-mkiv letterspacing
|
show 3 more comments
Generally, how do you deal with lines that are slightly overhung, when microtypography is already enabled, and there's no way of hyphenating the hanging word and no desire to put it on the next line, leaving ugly whitespaces (especially if the word on the first line of the paragraph)?
Here's an example with two hanging words:
I can think of two ways out:
- Margin tweaking: I make line width slightly larger.
- Negative tracking: I decrease letterspacing in the relevant line.
Are there any other methods within given constrains? Which one is a better practice?
EDIT: I was able to implement the negative tracking in ConTeXt with kerncharacters
command, and it looks quite nice:
% ConTeXt code
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=quality]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
starttext
{ kerncharacters[-0.02] Здесь будет длинный-предлинный текст, mbox{в~коем}} никак нельзя перенести строку.
Запрещено {kerncharacters[-0.01] разрывать телефонные номера, например, mbox{(000)1234-5678}}, многозначные числа и дефисные написания.
stoptext
line-breaking typography context-mkiv letterspacing
I try to rephrase at this point. In some cases, I simply ignore the bad box. (If it is not obvious or I'm not working on what will be the final, printed version, for example.)
– cfr
Jan 12 '16 at 23:09
Note that microtypography is only fully supported by pdfTeX. LuaTeX and XeTeX have more support than they used to, but not as much as pdfTeX. One of them (Lua?) has significantly better support than the other (Xe?). See themicrotype
's manual for details. I'm assuming that ConTeXt's support will be the same as LuaTeX's. Also, note that 14pt font on A5 is likely to generate problems of this sort with reasonable frequency. And remember that microtypography works best when using font-specific settings. Generic settings must needs be fairly conservative.
– cfr
Jan 12 '16 at 23:13
2
It may be possible to automate the kerncharacters trick. I remember seeing a ConTeXt demo on Arabic typesetting where such optimizations were performed after TeX had done the linebreaking. I don't remember where I saw that example. You may try searching the mailing list archives or asking on the ConTeXt mailing list.
– Aditya
Jan 12 '16 at 23:15
@cfr: assuming I cannot edit the text. And font/page settings were selected for the purpose of demonstration only, of course: I realize that such occurrences would be relatively infrequent at proper size settings, but they still hurt the eye, and I encountered four of just those in 20-page document before asking the question
– The_Keeper
Jan 12 '16 at 23:22
@Aditya: oh, that would be gold! I'll try to find it; and if you do, I'll be very grateful
– The_Keeper
Jan 12 '16 at 23:25
|
show 3 more comments
Generally, how do you deal with lines that are slightly overhung, when microtypography is already enabled, and there's no way of hyphenating the hanging word and no desire to put it on the next line, leaving ugly whitespaces (especially if the word on the first line of the paragraph)?
Here's an example with two hanging words:
I can think of two ways out:
- Margin tweaking: I make line width slightly larger.
- Negative tracking: I decrease letterspacing in the relevant line.
Are there any other methods within given constrains? Which one is a better practice?
EDIT: I was able to implement the negative tracking in ConTeXt with kerncharacters
command, and it looks quite nice:
% ConTeXt code
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=quality]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
starttext
{ kerncharacters[-0.02] Здесь будет длинный-предлинный текст, mbox{в~коем}} никак нельзя перенести строку.
Запрещено {kerncharacters[-0.01] разрывать телефонные номера, например, mbox{(000)1234-5678}}, многозначные числа и дефисные написания.
stoptext
line-breaking typography context-mkiv letterspacing
Generally, how do you deal with lines that are slightly overhung, when microtypography is already enabled, and there's no way of hyphenating the hanging word and no desire to put it on the next line, leaving ugly whitespaces (especially if the word on the first line of the paragraph)?
Here's an example with two hanging words:
I can think of two ways out:
- Margin tweaking: I make line width slightly larger.
- Negative tracking: I decrease letterspacing in the relevant line.
Are there any other methods within given constrains? Which one is a better practice?
EDIT: I was able to implement the negative tracking in ConTeXt with kerncharacters
command, and it looks quite nice:
% ConTeXt code
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=quality]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
starttext
{ kerncharacters[-0.02] Здесь будет длинный-предлинный текст, mbox{в~коем}} никак нельзя перенести строку.
Запрещено {kerncharacters[-0.01] разрывать телефонные номера, например, mbox{(000)1234-5678}}, многозначные числа и дефисные написания.
stoptext
line-breaking typography context-mkiv letterspacing
line-breaking typography context-mkiv letterspacing
edited Jan 12 '16 at 22:22
The_Keeper
asked Jan 12 '16 at 3:28
The_KeeperThe_Keeper
12819
12819
I try to rephrase at this point. In some cases, I simply ignore the bad box. (If it is not obvious or I'm not working on what will be the final, printed version, for example.)
– cfr
Jan 12 '16 at 23:09
Note that microtypography is only fully supported by pdfTeX. LuaTeX and XeTeX have more support than they used to, but not as much as pdfTeX. One of them (Lua?) has significantly better support than the other (Xe?). See themicrotype
's manual for details. I'm assuming that ConTeXt's support will be the same as LuaTeX's. Also, note that 14pt font on A5 is likely to generate problems of this sort with reasonable frequency. And remember that microtypography works best when using font-specific settings. Generic settings must needs be fairly conservative.
– cfr
Jan 12 '16 at 23:13
2
It may be possible to automate the kerncharacters trick. I remember seeing a ConTeXt demo on Arabic typesetting where such optimizations were performed after TeX had done the linebreaking. I don't remember where I saw that example. You may try searching the mailing list archives or asking on the ConTeXt mailing list.
– Aditya
Jan 12 '16 at 23:15
@cfr: assuming I cannot edit the text. And font/page settings were selected for the purpose of demonstration only, of course: I realize that such occurrences would be relatively infrequent at proper size settings, but they still hurt the eye, and I encountered four of just those in 20-page document before asking the question
– The_Keeper
Jan 12 '16 at 23:22
@Aditya: oh, that would be gold! I'll try to find it; and if you do, I'll be very grateful
– The_Keeper
Jan 12 '16 at 23:25
|
show 3 more comments
I try to rephrase at this point. In some cases, I simply ignore the bad box. (If it is not obvious or I'm not working on what will be the final, printed version, for example.)
– cfr
Jan 12 '16 at 23:09
Note that microtypography is only fully supported by pdfTeX. LuaTeX and XeTeX have more support than they used to, but not as much as pdfTeX. One of them (Lua?) has significantly better support than the other (Xe?). See themicrotype
's manual for details. I'm assuming that ConTeXt's support will be the same as LuaTeX's. Also, note that 14pt font on A5 is likely to generate problems of this sort with reasonable frequency. And remember that microtypography works best when using font-specific settings. Generic settings must needs be fairly conservative.
– cfr
Jan 12 '16 at 23:13
2
It may be possible to automate the kerncharacters trick. I remember seeing a ConTeXt demo on Arabic typesetting where such optimizations were performed after TeX had done the linebreaking. I don't remember where I saw that example. You may try searching the mailing list archives or asking on the ConTeXt mailing list.
– Aditya
Jan 12 '16 at 23:15
@cfr: assuming I cannot edit the text. And font/page settings were selected for the purpose of demonstration only, of course: I realize that such occurrences would be relatively infrequent at proper size settings, but they still hurt the eye, and I encountered four of just those in 20-page document before asking the question
– The_Keeper
Jan 12 '16 at 23:22
@Aditya: oh, that would be gold! I'll try to find it; and if you do, I'll be very grateful
– The_Keeper
Jan 12 '16 at 23:25
I try to rephrase at this point. In some cases, I simply ignore the bad box. (If it is not obvious or I'm not working on what will be the final, printed version, for example.)
– cfr
Jan 12 '16 at 23:09
I try to rephrase at this point. In some cases, I simply ignore the bad box. (If it is not obvious or I'm not working on what will be the final, printed version, for example.)
– cfr
Jan 12 '16 at 23:09
Note that microtypography is only fully supported by pdfTeX. LuaTeX and XeTeX have more support than they used to, but not as much as pdfTeX. One of them (Lua?) has significantly better support than the other (Xe?). See the
microtype
's manual for details. I'm assuming that ConTeXt's support will be the same as LuaTeX's. Also, note that 14pt font on A5 is likely to generate problems of this sort with reasonable frequency. And remember that microtypography works best when using font-specific settings. Generic settings must needs be fairly conservative.– cfr
Jan 12 '16 at 23:13
Note that microtypography is only fully supported by pdfTeX. LuaTeX and XeTeX have more support than they used to, but not as much as pdfTeX. One of them (Lua?) has significantly better support than the other (Xe?). See the
microtype
's manual for details. I'm assuming that ConTeXt's support will be the same as LuaTeX's. Also, note that 14pt font on A5 is likely to generate problems of this sort with reasonable frequency. And remember that microtypography works best when using font-specific settings. Generic settings must needs be fairly conservative.– cfr
Jan 12 '16 at 23:13
2
2
It may be possible to automate the kerncharacters trick. I remember seeing a ConTeXt demo on Arabic typesetting where such optimizations were performed after TeX had done the linebreaking. I don't remember where I saw that example. You may try searching the mailing list archives or asking on the ConTeXt mailing list.
– Aditya
Jan 12 '16 at 23:15
It may be possible to automate the kerncharacters trick. I remember seeing a ConTeXt demo on Arabic typesetting where such optimizations were performed after TeX had done the linebreaking. I don't remember where I saw that example. You may try searching the mailing list archives or asking on the ConTeXt mailing list.
– Aditya
Jan 12 '16 at 23:15
@cfr: assuming I cannot edit the text. And font/page settings were selected for the purpose of demonstration only, of course: I realize that such occurrences would be relatively infrequent at proper size settings, but they still hurt the eye, and I encountered four of just those in 20-page document before asking the question
– The_Keeper
Jan 12 '16 at 23:22
@cfr: assuming I cannot edit the text. And font/page settings were selected for the purpose of demonstration only, of course: I realize that such occurrences would be relatively infrequent at proper size settings, but they still hurt the eye, and I encountered four of just those in 20-page document before asking the question
– The_Keeper
Jan 12 '16 at 23:22
@Aditya: oh, that would be gold! I'll try to find it; and if you do, I'll be very grateful
– The_Keeper
Jan 12 '16 at 23:25
@Aditya: oh, that would be gold! I'll try to find it; and if you do, I'll be very grateful
– The_Keeper
Jan 12 '16 at 23:25
|
show 3 more comments
1 Answer
1
active
oldest
votes
You could combine the slight negative kerning which you already discovered with extreme shrinking in the font expansion.
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupfontexpansion
[extremeshrink]
[stretch=2,shrink=4,step=.5,vector=quality,factor=1]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=extremeshrink]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
definecharacterkerning [shrinkkern] [factor=-.01]
setcharacterkerning [shrinkkern]
starttext
Здесь будет длинный-предлинный текст, mbox{в~коем} никак нельзя перенести строку.
Запрещено разрывать телефонные номера, например, mbox{(000)1234-5678}, многозначные числа и дефисные написания.
stoptext
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f287189%2fdealing-with-slightly-overfull-hboxs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could combine the slight negative kerning which you already discovered with extreme shrinking in the font expansion.
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupfontexpansion
[extremeshrink]
[stretch=2,shrink=4,step=.5,vector=quality,factor=1]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=extremeshrink]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
definecharacterkerning [shrinkkern] [factor=-.01]
setcharacterkerning [shrinkkern]
starttext
Здесь будет длинный-предлинный текст, mbox{в~коем} никак нельзя перенести строку.
Запрещено разрывать телефонные номера, например, mbox{(000)1234-5678}, многозначные числа и дефисные написания.
stoptext
add a comment |
You could combine the slight negative kerning which you already discovered with extreme shrinking in the font expansion.
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupfontexpansion
[extremeshrink]
[stretch=2,shrink=4,step=.5,vector=quality,factor=1]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=extremeshrink]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
definecharacterkerning [shrinkkern] [factor=-.01]
setcharacterkerning [shrinkkern]
starttext
Здесь будет длинный-предлинный текст, mbox{в~коем} никак нельзя перенести строку.
Запрещено разрывать телефонные номера, например, mbox{(000)1234-5678}, многозначные числа и дефисные написания.
stoptext
add a comment |
You could combine the slight negative kerning which you already discovered with extreme shrinking in the font expansion.
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupfontexpansion
[extremeshrink]
[stretch=2,shrink=4,step=.5,vector=quality,factor=1]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=extremeshrink]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
definecharacterkerning [shrinkkern] [factor=-.01]
setcharacterkerning [shrinkkern]
starttext
Здесь будет длинный-предлинный текст, mbox{в~коем} никак нельзя перенести строку.
Запрещено разрывать телефонные номера, например, mbox{(000)1234-5678}, многозначные числа и дефисные написания.
stoptext
You could combine the slight negative kerning which you already discovered with extreme shrinking in the font expansion.
setuppapersize[A5]
setupbackgrounds[text] [rightframe=on,framecolor=red,rulethickness=0.1pt]
setupfontexpansion
[extremeshrink]
[stretch=2,shrink=4,step=.5,vector=quality,factor=1]
setupalign[hz,hanging] % microtypography enabled
definefontfeature[default][default][protrusion=quality,expansion=extremeshrink]
definetypeface[mainface][rm][specserif][Linux Libertine O] [default]
setupbodyfont[mainface,14pt]
mainlanguage[russian]
setupindenting[yes,medium,first]
definecharacterkerning [shrinkkern] [factor=-.01]
setcharacterkerning [shrinkkern]
starttext
Здесь будет длинный-предлинный текст, mbox{в~коем} никак нельзя перенести строку.
Запрещено разрывать телефонные номера, например, mbox{(000)1234-5678}, многозначные числа и дефисные написания.
stoptext
answered 28 mins ago
Henri MenkeHenri Menke
75.2k8164276
75.2k8164276
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f287189%2fdealing-with-slightly-overfull-hboxs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I try to rephrase at this point. In some cases, I simply ignore the bad box. (If it is not obvious or I'm not working on what will be the final, printed version, for example.)
– cfr
Jan 12 '16 at 23:09
Note that microtypography is only fully supported by pdfTeX. LuaTeX and XeTeX have more support than they used to, but not as much as pdfTeX. One of them (Lua?) has significantly better support than the other (Xe?). See the
microtype
's manual for details. I'm assuming that ConTeXt's support will be the same as LuaTeX's. Also, note that 14pt font on A5 is likely to generate problems of this sort with reasonable frequency. And remember that microtypography works best when using font-specific settings. Generic settings must needs be fairly conservative.– cfr
Jan 12 '16 at 23:13
2
It may be possible to automate the kerncharacters trick. I remember seeing a ConTeXt demo on Arabic typesetting where such optimizations were performed after TeX had done the linebreaking. I don't remember where I saw that example. You may try searching the mailing list archives or asking on the ConTeXt mailing list.
– Aditya
Jan 12 '16 at 23:15
@cfr: assuming I cannot edit the text. And font/page settings were selected for the purpose of demonstration only, of course: I realize that such occurrences would be relatively infrequent at proper size settings, but they still hurt the eye, and I encountered four of just those in 20-page document before asking the question
– The_Keeper
Jan 12 '16 at 23:22
@Aditya: oh, that would be gold! I'll try to find it; and if you do, I'll be very grateful
– The_Keeper
Jan 12 '16 at 23:25