如何使用 ieeecolor 忽略坏盒子?

如何使用 ieeecolor 忽略坏盒子?

我第一次使用ieeecolor.cls- 从https://www.embs.org/tmi/authors-instructions/,即https://www.embs.org/wp-content/uploads/2020/04/TMI-Template-LaTeX-2020.zip

让我恼火的是,期刊推荐的默认设置导致箱子过满或不足:

Overfull \hbox (109.0pt too wide) has occurred while \output is active
Overfull \hbox (162.0pt too wide) has occurred while \output is active
Underfull \hbox (badness 10000) has occurred while \output is active
Overfull \vbox (21.77283pt too high) has occurred while \output is active []

我尝试修复它们,但我真的不知道在哪里定义了最大宽度,所以我不知道为什么标题中的任何元素都超出了这些宽度。显然,它们没有超出标准页边距 160 点。然后我尝试抑制它们,但没有成功。

我还可以尝试什么?

\vfuzz=\maxdimen
\hfuzz=\maxdimen
\hbadness=100000
\vbadness=100000

\documentclass[print]{ieeecolor}

%\usepackage{tmi}
\def\logoname{LOGO-tmi-web}
\definecolor{subsectioncolor}{rgb}{0,0.541,0.855}
\setlength{\firstpagerule}{26.5pc}
\setlength{\logowidth}{16.5pc}
\def\journalname{IEEE Transactions on Medical Imaging}

\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\title{Long title: foo bar yada yada foo bar yes thank you that's enough.}
\markboth{\journalname}{Short title}
\author{Author one, two, three, four. \thanks{\lipsum[1]}}
\maketitle
\begin{abstract}
    \lipsum[2]
\end{abstract}
\lipsum[3]
\end{document}

答案1

部分基于@DavidCarlisle 的评论,这个答案在序言中对我有用。它有三个部分:第一部分关闭了发布页面上的大多数框警告。下一个块将框警告值设置回发布\maketitle页面末尾的先前值。\maketitle

我认为,第三个块仅对选项是必需的。它将头部代码中的journal替换为,保留所有间距,并仍然删除\vbox\parbox[c][15pt][c]

\vbox 过满(过高 5.0pt)

后续页面上的警告。

% Suppress other "Underfull hbox", "Overfull *box" just before \maketitle
\pretocmd{\maketitle}{%
    \newcounter{titlepage}\setcounter{titlepage}{\value{page}}%
    \newcount\oldhbadness\oldhbadness=\hbadness\hbadness=10000
    \newdimen\oldhfuzz\oldhfuzz=\hfuzz\hfuzz=162pt%
    \newdimen\oldvfuzz\oldvfuzz=\vfuzz\vfuzz=22pt%
}{}{Error.}

% Re-enable on following page
\AtBeginShipout{%
    \ifnumequal{\value{page}}{\value{titlepage}}{%
        \global\hbadness=\oldhbadness%
        \global\hfuzz=\oldhfuzz%
        \global\vfuzz=\oldvfuzz%
    }{}%
}

% Fix "Overfull \vbox (5.0pt too high)" on later pages
\patchcmd{\@evenhead}{%
    \vbox{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
}{%
    \parbox[c][15pt][c]{\textwidth}{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
}{}{Error.}
\patchcmd{\@oddhead}{%
    \vbox{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
}{%
    \parbox[c][15pt][c]{\textwidth}{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
}{}{Error.}
\makeatother

这个完整的 MWE 演示了抑制警告的效果,并生成了测试警告,表明仅在标题页上抑制了警告:

\documentclass[journal,twoside,web]{ieeecolor}
\usepackage{tmi}
\usepackage{graphicx}
\usepackage{lipsum}

\newif\ifgeneratetestwarnings
\generatetestwarningstrue

\newif\ifsuppressclasswarnings
\suppressclasswarningstrue
\ifsuppressclasswarnings
    \usepackage{etoolbox}
    \usepackage{atbegshi}

    % Suppress other "Underfull hbox", "Overfull *box" just before \maketitle
    \pretocmd{\maketitle}{%
        \newcounter{titlepage}\setcounter{titlepage}{\value{page}}%
        \newcount\oldhbadness\oldhbadness=\hbadness\hbadness=10000
        \newdimen\oldhfuzz\oldhfuzz=\hfuzz\hfuzz=162pt%
        \newdimen\oldvfuzz\oldvfuzz=\vfuzz\vfuzz=22pt%
    }{}{Error.}

    % Re-enable on following page
    \AtBeginShipout{%
        \ifnumequal{\value{page}}{\value{titlepage}}{%
            \global\hbadness=\oldhbadness%
            \global\hfuzz=\oldhfuzz%
            \global\vfuzz=\oldvfuzz%
        }{}%
    }

    % Fix "Overfull \vbox (5.0pt too high)" on later pages
    \makeatletter
    \patchcmd{\@evenhead}{%
        \vbox{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
    }{%
        \parbox[c][15pt][c]{\textwidth}{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
    }{}{Error.}
    \patchcmd{\@oddhead}{%
        \vbox{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
    }{%
        \parbox[c][15pt][c]{\textwidth}{\color{subsectioncolor}\hrule height1pt width43pc depth0pt}%
    }{}{Error.}
    \makeatother
\fi

\begin{document}
\title{Title}
\author{Author \thanks{Thanks.}}
\maketitle

\lipsum[1-17]

\ifgeneratetestwarnings
    This underfuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuull hbox should be a warning.

    This \mbox{overfuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuull} hbox, too (4.43956pt).

    \parbox[c][2in][s]{4cm}{This underfull vbox, too.}

    This overfull vbox, too (2.0pt):\newpage
    \begin{minipage}[t][690pt]{\textwidth}\end{minipage}
\fi

\end{document}

相关内容