0

Regarding this issue I would like to know if this is:

  • a bug in pdfTeX (in which case I'll escalate it)
  • a bug in LaTeX (in tabular*)
  • no bug at all

The following LaTeX code correctly creates this PDF output:

enter image description here

but with these messages (errors or warnings):

Overfull \vbox (1.49998pt too high) detected at line 18

Overfull \vbox (1.49998pt too high) detected at line 21

TeX code:

\documentclass[10pt, twoside, a4paper]{report}
    \usepackage[utf8x]{inputenc}
    \usepackage[english]{babel}
    \usepackage{fontenc}
    \usepackage[ top=21mm, bottom=21mm, left=12mm, right=8mm]{geometry}
    \usepackage{multirow}
\begin{document}

\sffamily
\begin{scriptsize}
\begin{tabular*}{0.45\textwidth}[t]{@{\extracolsep{\fill}}|r|ccc|ccc|}
    \multicolumn{7}{c}{\normalsize{}} \\
    \hline
    \multicolumn{1}{|c|}{} & & & \multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & & \multicolumn{1}{c|}{}\\[-2.0ex]
    \multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Lat.}}} & 
    \multicolumn{2}{c}{\multirow{1}{*}{\footnotesize{\textbf{Twilight}}}} & 
    \multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Sunrise}}} & 
    \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Sunset}}} & 
    \multicolumn{2}{c|}{\multirow{1}{*}{\footnotesize{\textbf{Twilight}}}} \\[0.6ex] 

    \multicolumn{1}{|c|}{} & 
    \multicolumn{1}{c}{Naut.} & 
    \multicolumn{1}{c}{Civil} & 
    \multicolumn{1}{|c|}{} & 
    \multicolumn{1}{c|}{} & 
    \multicolumn{1}{c}{Civil} & 
    \multicolumn{1}{c|}{Naut.}\\ 
    \hline
\end{tabular*}
\end{scriptsize}
\end{document}

However if I simply remove "\footnotesize{...}" from the LaTeX code above (two instances), the error (or warning?) messages disappear!

And the following (again correct) PDF is generated:

enter image description here

I cannot understand that insertion of my desired font size "\footnotesize{}" should be the cause of any error/warning messages. (Over 350 of these messages are produced by my Python code making it look very unprofessional - hence I would to fix this issue.)

My environment is: Windows 10, Python, MiKTeX 2.9.7269 and the command issued is:

pdflatex <filename.tex>
6
  • 1
    you have specified footnotesize text in a box based on a lineheight as set by scriptsize (which is smaller), so the text does not fit. so it's just a bug in your code. Feb 4, 2020 at 22:09
  • 1
    note that size commands do not take an argument, it should be \footnotesize not \footnotesize{....} (but that makes no difference here) Feb 4, 2020 at 22:10
  • understood. So is there a correct way to code what I want?
    – Aendie
    Feb 4, 2020 at 22:11
  • what is the intention of the \multirow{1}{*} here? you could simply delete that and the over full box would go Feb 4, 2020 at 22:12
  • I was probably copying code I saw elsewhere. Brilliant answer - I'll give that a try. That works! I'm very grateful for your assistance. Many thanks!!
    – Aendie
    Feb 4, 2020 at 22:14

2 Answers 2

3

You have specified footnotesize text in a box based on a lineheight as set by scriptsize (which is smaller), so the text does not fit. so it's just a bug in your code.

Note that size commands do not take an argument, it should be \footnotesize not \footnotesize{....} (but that makes no difference here)

What is the intention of the \multirow{1}{*} here? you could simply delete that and the over full box would go. In fact almost all of the \multicolumn and \multirow could be removed, however:

\documentclass[10pt, twoside, a4paper]{report}
%    \usepackage[utf8x]{inputenc}
    \usepackage[english]{babel}
    \usepackage{fontenc}
    \usepackage[ top=21mm, bottom=21mm, left=12mm, right=8mm]{geometry}
    \usepackage{multirow}

\begin{document}

\sffamily
\begin{scriptsize}
\begin{tabular*}{0.45\textwidth}[t]{@{\extracolsep{\fill}}|r|ccc|ccc|}
    \multicolumn{7}{c}{\normalsize{}} \\
    \hline
    \multicolumn{1}{|c|}{} & & & \multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & & \multicolumn{1}{c|}{}\\[-2.0ex]
    \multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Lat.}}} & 
    \multicolumn{2}{c}{{\footnotesize{\textbf{Twilight}}}} & 
    \multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Sunrise}}} & 
    \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Sunset}}} & 
    \multicolumn{2}{c|}{{\footnotesize{\textbf{Twilight}}}} \\[0.6ex] 

    \multicolumn{1}{|c|}{} & 
    \multicolumn{1}{c}{Naut.} & 
    \multicolumn{1}{c}{Civil} & 
    \multicolumn{1}{|c|}{} & 
    \multicolumn{1}{c|}{} & 
    \multicolumn{1}{c}{Civil} & 
    \multicolumn{1}{c|}{Naut.}\\ 
    \hline
\end{tabular*}

\end{scriptsize}
\end{document}

I couldn't leave it like the above:-) I delete most of the markup:

\documentclass[10pt, twoside, a4paper]{report}
% don't use utf8x, and you do not need utf8 in any reasonably
% current latex as it is the default
%    \usepackage[utf8x]{inputenc} 

    \usepackage[english]{babel}
    \usepackage{fontenc}
    \usepackage[ top=21mm, bottom=21mm, left=12mm, right=8mm]{geometry}
    \usepackage{multirow}
    \usepackage{array}
\begin{document}

\sffamily
\begin{scriptsize}
\setlength\extrarowheight{2pt}
\begin{tabular}[t]{@{}|c|cc|cc|cc|@{}}
    \hline
    \multirow{2}{*}{\textbf{Lat.}}& 
    \multicolumn{2}{c|}{\footnotesize \textbf{Twilight}} & 
    \multirow{2}{*}{\textbf{Sunrise}} & 
    \multirow{2}{*}{\textbf{Sunset}} & 
    \multicolumn{2}{c|}{\footnotesize\textbf{Twilight}}\\[0.6ex] 
      & 
    Naut. & 
   Civil & 
    &
     & 
   Civil & 
   Naut.\\ 
    \hline
\end{tabular}


% always leave a paragraph end before the end of a size change
\end{scriptsize}
\end{document}
0

Today for your table I would use tabularray package. By its syntax enable to write table setting in table preamble:

  • separately set font size in the first and other rows,
  • reduce distance between first and second row
\documentclass[10pt, twoside, a4paper]{report}
\usepackage[hmargin={12mm,8mm}, vmargin={21mm, 21mm}]{geometry}
\usepackage[english]{babel}
\usepackage{fontenc}
\usepackage{tabularray}

\begin{document}
\noindent%
\begin{tblr}{width   = 0.45\textwidth,
             colspec = {|r|*{2}{X[c]}|c | c| *{2}{X[c]}|},
             row{1}  = {font=\footnotesize\bfseries, belowsep=-3pt},
             row{2}  = {abovesep=0pt},
             row{2-Z} = {font=\scriptsize\sffamily},
             }
    \hline
\SetCell[r=2]{m}   Lat.     % multi row cell
    &   \SetCell[c=2]{c}    Twilight    % multi column cell
        &   &   \SetCell[r=2]{m}   Sunrise
                &   \SetCell[r=2]{m}   Sunset
                    &   \SetCell[c=2]{c}    Twilight
                        &       \\

    & Civil 
        &   Naut.  
            &   &   &   Civil 
                        & Naut. \\
    \hline
\end{tblr}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .