Dealing with slightly overfull hbox's












4















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:



Example of overhanging lines



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:



Fixed overhung text



% 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









share|improve this question

























  • 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
















4















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:



Example of overhanging lines



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:



Fixed overhung text



% 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









share|improve this question

























  • 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














4












4








4


1






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:



Example of overhanging lines



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:



Fixed overhung text



% 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









share|improve this question
















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:



Example of overhanging lines



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:



Fixed overhung text



% 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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

















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










1 Answer
1






active

oldest

votes


















0














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





share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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





    share|improve this answer




























      0














      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





      share|improve this answer


























        0












        0








        0







        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





        share|improve this answer













        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






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 28 mins ago









        Henri MenkeHenri Menke

        75.2k8164276




        75.2k8164276






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks