TransWikia.com

makebox causes "Underfull hbox" warning when it's in an NewDocumentEnvironment

TeX - LaTeX Asked by AltairAC on July 3, 2021

MWE:

%! TEX program = lualatex

documentclass[fleqn, oneside, titlepage = false, fontsize = 12pt]{scrbook}

usepackage{xparse}

usepackage{fontspec}

setmainfont{cmun}[
    Extension=.otf,
    UprightFont=*rm,
    ItalicFont=*ti,
    BoldFont=*bx,
    BoldItalicFont=*bi,
]

usepackage{IEEEtrantools}

NewDocumentEnvironment{sustav3x3xyz}{b}
{%
noindentmakebox[textwidth][c]{begin{minipage}{6cm}
    begin{IEEEeqnarray}{rlCrlCrlCl}
        #1
    addtocounter{equation}{1}
    end{IEEEeqnarray}
end{minipage}}
}{}

% https://tex.stackexchange.com/questions/149370/ieeeeqnarray-tag-like-command
makeatletter
newcommandztag[1]{%
def@currentlabel{#1}%
gdeftmp{%
addtocounter{equation}{-1}%
deftheequation{#1}}%
aftergroupaftergroupaftergroupaftergroupaftergroupaftergroup
aftergroupaftergroupaftergroupaftergroupaftergroupaftergroup
aftergroupaftergroupaftergroupaftergroupaftergroupaftergroup
aftergroupaftergroupaftergroupaftergroupaftergroupaftergroup
aftergroupaftergroupaftergroupaftergroupaftergroupaftergroup
aftergroup
tmp}

begin{document}

        noindentmakebox[textwidth][c]{%
        begin{minipage}{6cm}
        begin{IEEEeqnarray}{rlCrlCrlCl}
            2&x &+& 2&y &-& 2&z & = & 1 ztag{1}
            *
            3&x &+& 5&y &-& 2&z & = & 2 ztag{2}
            *
            3&x &+& 5&y &-& &z & = & 3 ztag{3}
            addtocounter{equation}{1}
        end{IEEEeqnarray}end{minipage}}

        begin{sustav3x3xyz}
            2&x &+& 2&y &-& 2&z & = & 1 ztag{1}
            *
            3&x &+& 5&y &-& 2&z & = & 2 ztag{2}
            *
            3&x &+& 5&y &-& &z & = & 3 ztag{3}
        end{sustav3x3xyz}

end{document}

Result:
Systems of equations


Warning

warning| Underfull hbox (badness 10000) in paragraph ...

The warning refers to the second system of equations. If I remove that system, the warning goes away. Also, if I just remove the makebox from the second system, the warning goes away. I use makebox to center both systems horizontally. The code for both systems is nearly identical, except that the second system relies on NewDocumentEnvironment.

One Answer

Either set parfillskip to 0 in the environment, or (probably better) use centering instead of this makebox

NewDocumentEnvironment{sustav3x3xyz}{b}
{%parfillskip=0pt % with the makebox
centering
%noindentmakebox[textwidth][c]{%
 begin{minipage}{6cm}
    begin{IEEEeqnarray}{rlCrlCrlCl}
        #1
    addtocounter{equation}{1}
    end{IEEEeqnarray}
end{minipage}%
%}
par% for the centering
}{}

Btw: The ztag definition leads to duplicate destinations and so links will not work correctly:

warning  (pdf backend): ignoring duplicate destination with the name 'equation.1
.1.0'

Correct answer by Ulrike Fischer on July 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP