Re: [XeTeX] Overfull \hbox when using inline math scripts
2011/12/16 Zdenek Wagner : > Generally speaking, paragraph breaking is controlled by a few > registers, the most important is \tolerance. \sloppy sets \tolerance > to 1 which then looks ugly. You should start with \tolerance=. > In such a case you should not have overfull boxes (if you still have > them, some changes in the text may be needed). After this run you find > the highest badness of the underfull box. Set \tolerance to this value > and \hbadness to one less and run LaTeX again. You should see just one > underfull box in your log. Now you can decrease \tolerance (and > badness) until you get an overfull box, then return to the higher > value of \tolerance and set \hbadness to the same value. If you have a > paragraph with an overfull box, then set locally for that paragraph > \emergencystretch=1em. (This algorithm appeared years ago in an > article by Phil Taylor and I use it since then) On Sat, Dec 17, 2011 at 3:16 AM, Conrad Scott wrote: > One possible solution for the particular example you posted (see below) is > to allow line breaks at commas in inline maths. The solution I use for this > is: > \mathchardef\breakingcomma\mathcode`\, > {\catcode`,=\active > \gdef,{\breakingcomma\discretionary{}{}{}}} > \newcommand{\mathlist}[1]{$\mathcode`\,=\string"8000 #1$} Thank you Philip, Zdenek, and Conrad for your great suggestions. I think maybe I can use the Philip/Zdenek solution for most cases, and the Conrad solution for problems that still may persist after that. Thanks again, Dan On Sat, Dec 17, 2011 at 3:16 AM, Conrad Scott wrote: > Dan, > > One possible solution for the particular example you posted (see below) is > to allow line breaks at commas in inline maths. The solution I use for this > is: > > \mathchardef\breakingcomma\mathcode`\, > > {\catcode`,=\active > > \gdef,{\breakingcomma\discretionary{}{}{}} > > } > > > \newcommand{\mathlist}[1]{$\mathcode`\,=\string"8000 #1$} > > > which I took from the answer by egreg to the following stackexchange > question: > > http://tex.stackexchange.com/questions/19094/allowing-line-break-at-in-inline-math-mode-breaks-citations > > > You could use this as "Let the tuple $(\mathlist{X, Y, Z, A, B, C, +, x, -, > !, \#})$" in your example. > > > There are some other solutions in that post and the other it links to. > > > All my best, > Conrad > > On 12/16/2011 01:55 AM, Daniel Greenhoe wrote: > > I have a rather long document involving mathematics that sometimes has > the "Overfull \hbox" problem when I use inline mathematical scripts. > Before I go hacking up the document with newline and \raggedright > commands, is there any more elegant solution currently available? > Below (see also attachment) is an example: > > \documentclass[12pt]{book} > \usepackage{fontspec} > \usepackage{unicode-math} > \usepackage{geometry} > \geometry{ > xetex,centering,twoside,noheadfoot,nomarginpar, > paper=a4paper,margin=20mm, > showframe > } > \setmainfont{texgyrepagella-regular.otf} > \setmathfont{xits-math.otf} > \setlength{\parindent}{0pt} > \begin{document}% > \thispagestyle{empty}% > %\sloppy > %\raggedright > Theorem 1.1 (The Theorem That Has This Rather Long Title) > Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ > be some useful mathematical structure. > Then, \ldots > \end{document}% > > Many thanks in advance, > Dan > > > > > > -- > Subscriptions, Archive, and List information, etc.: > http://tug.org/mailman/listinfo/xetex > > > > > > -- > Subscriptions, Archive, and List information, etc.: > http://tug.org/mailman/listinfo/xetex > -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
Dan, One possible solution for the particular example you posted (see below) is to allow line breaks at commas in inline maths. The solution I use for this is: \mathchardef\breakingcomma\mathcode`\, {\catcode`,=\active \gdef,{\breakingcomma\discretionary{}{}{}} } \newcommand{\mathlist}[1]{$\mathcode`\,=\string"8000 #1$} which I took from the answer by egreg to the following stackexchange question: http://tex.stackexchange.com/questions/19094/allowing-line-break-at-in-inline-math-mode-breaks-citations You could use this as "Let the tuple $(\mathlist{X, Y, Z, A, B, C, +, x, -, !, \#})$" in your example. There are some other solutions in that post and the other it links to. All my best, Conrad On 12/16/2011 01:55 AM, Daniel Greenhoe wrote: I have a rather long document involving mathematics that sometimes has the "Overfull \hbox" problem when I use inline mathematical scripts. Before I go hacking up the document with newline and \raggedright commands, is there any more elegant solution currently available? Below (see also attachment) is an example: \documentclass[12pt]{book} \usepackage{fontspec} \usepackage{unicode-math} \usepackage{geometry} \geometry{ xetex,centering,twoside,noheadfoot,nomarginpar, paper=a4paper,margin=20mm, showframe } \setmainfont{texgyrepagella-regular.otf} \setmathfont{xits-math.otf} \setlength{\parindent}{0pt} \begin{document}% \thispagestyle{empty}% %\sloppy %\raggedright Theorem 1.1 (The Theorem That Has This Rather Long Title) Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ be some useful mathematical structure. Then, \ldots \end{document}% Many thanks in advance, Dan -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
2011/12/16 Philip TAYLOR : > > > Zdenek Wagner wrote: > >> You should start with \tolerance=. >> In such a case you should not have overfull boxes (if you still have >> them, some changes in the text may be needed). After this run you find >> the highest badness of the underfull box. Set \tolerance to this value >> and \hbadness to one less and run LaTeX again. You should see just one >> underfull box in your log. Now you can decrease \tolerance (and >> badness) until you get an overfull box, then return to the higher >> value of \tolerance and set \hbadness to the same value. If you have a >> paragraph with an overfull box, then set locally for that paragraph >> \emergencystretch=1em. (This algorithm appeared years ago in an >> article by Phil Taylor and I use it since then) > > > So do I (!), but I am fairly certain that Frank Mittelbach subsequently > proved that there is a far simpler way of achieving exactly the same > results, with considerably less effort. Frank, are you there ? > It's not that much effort. I do not care about overfull boxes until the text is finished and proof read. And then I have a few macros that help me to do it quite quickly. In pdftex hz-algorithm can sometimes help but not always. > ** Phil. > > > > -- > Subscriptions, Archive, and List information, etc.: > http://tug.org/mailman/listinfo/xetex -- Zdeněk Wagner http://hroch486.icpf.cas.cz/wagner/ http://icebearsoft.euweb.cz -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
Zdenek Wagner wrote: You should start with \tolerance=. In such a case you should not have overfull boxes (if you still have them, some changes in the text may be needed). After this run you find the highest badness of the underfull box. Set \tolerance to this value and \hbadness to one less and run LaTeX again. You should see just one underfull box in your log. Now you can decrease \tolerance (and badness) until you get an overfull box, then return to the higher value of \tolerance and set \hbadness to the same value. If you have a paragraph with an overfull box, then set locally for that paragraph \emergencystretch=1em. (This algorithm appeared years ago in an article by Phil Taylor and I use it since then) So do I (!), but I am fairly certain that Frank Mittelbach subsequently proved that there is a far simpler way of achieving exactly the same results, with considerably less effort. Frank, are you there ? ** Phil. -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
2011/12/16 Zdenek Wagner : > 2011/12/16 Keith J. Schultz : >> Hi, >> >> I would suggest putting a newline after the therorem title. Could right your >> own command >> for that. >> Just one more remark, if you want to change \emergencystretch locally, it is not necessary to put the whole paragraph into a group, just enter immediatelly after the last character of the paragraph the following: {\emergencystretch=1em \par} >> Though it is a matter of style and taste. >> >> regards >> Keith. >> >> Am 16.12.2011 um 02:55 schrieb Daniel Greenhoe: >> > Generally speaking, paragraph breaking is controlled by a few > registers, the most important is \tolerance. \sloppy sets \tolerance > to 1 which then looks ugly. You should start with \tolerance=. > In such a case you should not have overfull boxes (if you still have > them, some changes in the text may be needed). After this run you find > the highest badness of the underfull box. Set \tolerance to this value > and \hbadness to one less and run LaTeX again. You should see just one > underfull box in your log. Now you can decrease \tolerance (and > badness) until you get an overfull box, then return to the higher > value of \tolerance and set \hbadness to the same value. If you have a > paragraph with an overfull box, then set locally for that paragraph > \emergencystretch=1em. (This algorithm appeared years ago in an > article by Phil Taylor and I use it since then) > >>> I have a rather long document involving mathematics that sometimes has >>> the "Overfull \hbox" problem when I use inline mathematical scripts. >>> Before I go hacking up the document with newline and \raggedright >>> commands, is there any more elegant solution currently available? >>> Below (see also attachment) is an example: >>> >>> \documentclass[12pt]{book} >>> \usepackage{fontspec} >>> \usepackage{unicode-math} >>> \usepackage{geometry} >>> \geometry{ >>> xetex,centering,twoside,noheadfoot,nomarginpar, >>> paper=a4paper,margin=20mm, >>> showframe >>> } >>> \setmainfont{texgyrepagella-regular.otf} >>> \setmathfont{xits-math.otf} >>> \setlength{\parindent}{0pt} >>> \begin{document}% >>> \thispagestyle{empty}% >>> %\sloppy >>> %\raggedright >>> Theorem 1.1 (The Theorem That Has This Rather Long Title) >>> Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ >>> be some useful mathematical structure. >>> Then, \ldots >>> \end{document}% >>> >>> Many thanks in advance, >>> Dan >>> >>> >>> -- >>> Subscriptions, Archive, and List information, etc.: >>> http://tug.org/mailman/listinfo/xetex >> >> >> >> >> -- >> Subscriptions, Archive, and List information, etc.: >> http://tug.org/mailman/listinfo/xetex > > > > -- > Zdeněk Wagner > http://hroch486.icpf.cas.cz/wagner/ > http://icebearsoft.euweb.cz -- Zdeněk Wagner http://hroch486.icpf.cas.cz/wagner/ http://icebearsoft.euweb.cz -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
2011/12/16 Keith J. Schultz : > Hi, > > I would suggest putting a newline after the therorem title. Could right your > own command > for that. > > Though it is a matter of style and taste. > > regards > Keith. > > Am 16.12.2011 um 02:55 schrieb Daniel Greenhoe: > Generally speaking, paragraph breaking is controlled by a few registers, the most important is \tolerance. \sloppy sets \tolerance to 1 which then looks ugly. You should start with \tolerance=. In such a case you should not have overfull boxes (if you still have them, some changes in the text may be needed). After this run you find the highest badness of the underfull box. Set \tolerance to this value and \hbadness to one less and run LaTeX again. You should see just one underfull box in your log. Now you can decrease \tolerance (and badness) until you get an overfull box, then return to the higher value of \tolerance and set \hbadness to the same value. If you have a paragraph with an overfull box, then set locally for that paragraph \emergencystretch=1em. (This algorithm appeared years ago in an article by Phil Taylor and I use it since then) >> I have a rather long document involving mathematics that sometimes has >> the "Overfull \hbox" problem when I use inline mathematical scripts. >> Before I go hacking up the document with newline and \raggedright >> commands, is there any more elegant solution currently available? >> Below (see also attachment) is an example: >> >> \documentclass[12pt]{book} >> \usepackage{fontspec} >> \usepackage{unicode-math} >> \usepackage{geometry} >> \geometry{ >> xetex,centering,twoside,noheadfoot,nomarginpar, >> paper=a4paper,margin=20mm, >> showframe >> } >> \setmainfont{texgyrepagella-regular.otf} >> \setmathfont{xits-math.otf} >> \setlength{\parindent}{0pt} >> \begin{document}% >> \thispagestyle{empty}% >> %\sloppy >> %\raggedright >> Theorem 1.1 (The Theorem That Has This Rather Long Title) >> Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ >> be some useful mathematical structure. >> Then, \ldots >> \end{document}% >> >> Many thanks in advance, >> Dan >> >> >> -- >> Subscriptions, Archive, and List information, etc.: >> http://tug.org/mailman/listinfo/xetex > > > > > -- > Subscriptions, Archive, and List information, etc.: > http://tug.org/mailman/listinfo/xetex -- Zdeněk Wagner http://hroch486.icpf.cas.cz/wagner/ http://icebearsoft.euweb.cz -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
On Fri, Dec 16, 2011 at 10:50 AM, Vladimir Lomov wrote: \theoremstyle{break} I would like to use something like this. However this directive blindly puts a break after all the theorem headers, not just where it is needed. The entire document is over 300 pages long with many theorems and the like, and I would prefer that it was not so wasteful with white space. Dan On Fri, Dec 16, 2011 at 10:50 AM, Vladimir Lomov wrote: > Hello, > ** Daniel Greenhoe [2011-12-16 09:55:19 +0800]: > >> I have a rather long document involving mathematics that sometimes has >> the "Overfull \hbox" problem when I use inline mathematical scripts. >> Before I go hacking up the document with newline and \raggedright >> commands, is there any more elegant solution currently available? >> Below (see also attachment) is an example: > >> \documentclass[12pt]{book} >> \usepackage{fontspec} >> \usepackage{unicode-math} >> \usepackage{geometry} >> \geometry{ >> xetex,centering,twoside,noheadfoot,nomarginpar, >> paper=a4paper,margin=20mm, >> showframe >> } >> \setmainfont{texgyrepagella-regular.otf} >> \setmathfont{xits-math.otf} >> \setlength{\parindent}{0pt} >> \begin{document}% >> \thispagestyle{empty}% >> %\sloppy >> %\raggedright >> Theorem 1.1 (The Theorem That Has This Rather Long Title) >> Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ >> be some useful mathematical structure. >> Then, \ldots >> \end{document}% > >> Many thanks in advance, >> Dan > > It might won't help you with you real case but this example can be > improved > > [example] > \documentclass[12pt]{book} > \usepackage{fontspec} > \usepackage{unicode-math} > \usepackage{amsmath} %%% Just becuase I very like this package > \usepackage{theorem} > \usepackage{geometry} > \geometry{ > xetex,centering,twoside,noheadfoot,nomarginpar, > paper=a4paper,margin=20mm, > showframe > } > > \theoremstyle{break} > \newtheorem{theorem}{Theorem}[chapter] > > \setmainfont{texgyrepagella-regular.otf} > \setmathfont{xits-math.otf} > \setlength{\parindent}{0pt} > \begin{document}% > \thispagestyle{empty}% > %\sloppy > %\raggedright > \begin{theorem}[The Theorem That Has This Rather Long Title] > Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ > be some useful mathematical structure. > Then, \ldots > \end{theorem} > \end{document}% > [/example] > > -- > What upsets me is not that you lied to me, but that from now on I can no > longer believe you. > -- Nietzsche > > > -- > Subscriptions, Archive, and List information, etc.: > http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
Hi, I would suggest putting a newline after the therorem title. Could right your own command for that. Though it is a matter of style and taste. regards Keith. Am 16.12.2011 um 02:55 schrieb Daniel Greenhoe: > I have a rather long document involving mathematics that sometimes has > the "Overfull \hbox" problem when I use inline mathematical scripts. > Before I go hacking up the document with newline and \raggedright > commands, is there any more elegant solution currently available? > Below (see also attachment) is an example: > > \documentclass[12pt]{book} > \usepackage{fontspec} > \usepackage{unicode-math} > \usepackage{geometry} > \geometry{ > xetex,centering,twoside,noheadfoot,nomarginpar, > paper=a4paper,margin=20mm, > showframe > } > \setmainfont{texgyrepagella-regular.otf} > \setmathfont{xits-math.otf} > \setlength{\parindent}{0pt} > \begin{document}% > \thispagestyle{empty}% > %\sloppy > %\raggedright > Theorem 1.1 (The Theorem That Has This Rather Long Title) > Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ > be some useful mathematical structure. > Then, \ldots > \end{document}% > > Many thanks in advance, > Dan > > > -- > Subscriptions, Archive, and List information, etc.: > http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Overfull \hbox when using inline math scripts
Hello, ** Daniel Greenhoe [2011-12-16 09:55:19 +0800]: > I have a rather long document involving mathematics that sometimes has > the "Overfull \hbox" problem when I use inline mathematical scripts. > Before I go hacking up the document with newline and \raggedright > commands, is there any more elegant solution currently available? > Below (see also attachment) is an example: > \documentclass[12pt]{book} > \usepackage{fontspec} > \usepackage{unicode-math} > \usepackage{geometry} > \geometry{ > xetex,centering,twoside,noheadfoot,nomarginpar, > paper=a4paper,margin=20mm, > showframe > } > \setmainfont{texgyrepagella-regular.otf} > \setmathfont{xits-math.otf} > \setlength{\parindent}{0pt} > \begin{document}% > \thispagestyle{empty}% > %\sloppy > %\raggedright > Theorem 1.1 (The Theorem That Has This Rather Long Title) > Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ > be some useful mathematical structure. > Then, \ldots > \end{document}% > Many thanks in advance, > Dan It might won't help you with you real case but this example can be improved [example] \documentclass[12pt]{book} \usepackage{fontspec} \usepackage{unicode-math} \usepackage{amsmath} %%% Just becuase I very like this package \usepackage{theorem} \usepackage{geometry} \geometry{ xetex,centering,twoside,noheadfoot,nomarginpar, paper=a4paper,margin=20mm, showframe } \theoremstyle{break} \newtheorem{theorem}{Theorem}[chapter] \setmainfont{texgyrepagella-regular.otf} \setmathfont{xits-math.otf} \setlength{\parindent}{0pt} \begin{document}% \thispagestyle{empty}% %\sloppy %\raggedright \begin{theorem}[The Theorem That Has This Rather Long Title] Let the tuple $(X, Y, Z, A, B, C, +, x, -, !, \#)$ be some useful mathematical structure. Then, \ldots \end{theorem} \end{document}% [/example] -- What upsets me is not that you lied to me, but that from now on I can no longer believe you. -- Nietzsche -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex