0

I'm writing a book using LaTeX in Overleaf (pdfLaTeX), using the tufte-book document type. To make my title page, I have the following code:

\documentclass[notoc,symmetric]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\title{Sliiightly Long Title \\ \LARGE With A Subtitle}
\begin{document}
\maketitle

The formatting works fine, but the title ends up with an unsightly black bar in the rendered PDF, as such:

title image

Checking the warnings, I see that I'm getting Overfull \hbox (8.42856pt too wide). I can manually set the font size down to \Huge, but it's much too small and it just looks bad. \HUGE from moresize looks more ok, but I have the title in a running head in the rest of the book and it makes it \HUGE there too. (It also makes the subtitle \LARGE in the running head, but I decided I actually kind of like the effect there and so I left it.)

Ultimately, I just want to be rid of that black bar from the overfull \hbox. (Why is it even doing that in this case, I don't think I usually see that when I overfill an \hbox?) Does anyone know a way to do this, preferably one that won't mess up my running head or completely ruin the title formatting?

9
  • You might want to squish the space in the subtitle. Jul 19, 2018 at 20:56
  • @Oleg Lobachev If I remove the space from the subtitle, my running head ends up with no space between the title and the subtitle, which is no good. Also I kind of like how it looks tabbed in like that, although I'm sure it's not really what the tufte-latex people would have wanted. Jul 19, 2018 at 21:05
  • Please provide a compilable example which demonstrates the problem. So you need \end{document} at least but, if headers might be an issue, you need code which produces some headers, too. Otherwise, we don't have anything to work with.
    – cfr
    Jul 19, 2018 at 22:47
  • 1
    Are you sure you don't have the draft option somewhere in your class options? In draft mode, LaTeX marks bad hboxes with blocks in the margin.
    – cfr
    Jul 19, 2018 at 22:58
  • 1
    I DID HAVE THE DRAFT OPTION SET! I just forgot where it was set in the new Overleaf v2 interface. For anyone from the internet looking for a "why" answer to this question, this is why. For reference, draft is now set in Overleaf v2 in a dropdown menu next to the "Recompile" button, not in the document setting menu. Jul 20, 2018 at 1:44

1 Answer 1

1

I cannot reproduce the issue in the question when I add \end{document} to complete the code. I get an overfull \hbox warning, but no grey or black block appears in the output. The only thing I know of which might cause this is if you are using the draft option, since LaTeX indicates the whereabouts of bad \hboxes visually with blocks in the margin.

So my answer attempts to eliminate the warning. Since I cannot reproduce the block in the output, I cannot diagnose its cause or attempt to resolve the problem. Nor, therefore, can I say whether eliminating the bad box will eliminate the block. It does, however, eliminate the warning.

Caveat emptor

I would consider doing something like the following:

  • adjust the use of letter-spacing for the title so that the caps here are not quite as spaced out and \allcaps would give you (below, I use 150 rather than 200, but you will need to adjust as desired);

    \newcommand{\titleallcapsspacing}[1]{\textls[150]{#1}}% adjust this as appropriate
    

    \fontsize{36}{40}\selectfont\par\noindent\textcolor{darkgray}{\titleallcapsspacing{\MakeTextUppercase{\thanklesstitle}}}%
    
  • create a new macro \subtitle, based on the class's \title for a subtitle;

    \newcommand\@subtitle{}
    \newcommand\plainsubtitle{}
    \newif\if@subtitle
    \newcommand{\subtitle}[2][]{%
      \@subtitletrue
      \gdef\@subtitle{#2}%
      \begingroup
        % TODO store contents of \thanks command
        \renewcommand{\thanks}[1]{}% swallow \thanks contents
        \protected@xdef\thanklesssubtitle{#2}%
      \endgroup
      \ifthenelse{\isempty{#1}}%
      {\renewcommand{\plainsubtitle}{\thanklesstitle}}% use thankless subtitle
      {\renewcommand{\plainsubtitle}{#1}}% use provided plain-text subtitle
    }
    
  • customise \maketitlepage to use the \subtitle;

    \if@subtitle
      \smallskip\par
      \LARGE\textcolor{darkgray}{\allcaps{\thanklesssubtitle}}%
    \fi
    
  • adapt, if appropriate, the definitions of headers, footers or whatever to incorporate \plainsubtitle (not shown below as I don't know what you have or haven't got or what you do or don't want here, but, obviously, you can use \LARGE or something if you really want to, though it seems odd to have the subtitle larger than the title - or maybe I've misunderstood what you've got).

Then, you can write something like

\title{Sliiightly Long Title}
\subtitle{With A Subtitle}

\maketitle

to produce the following result, with no bad boxes.

only good boxes here

Code:

\documentclass[notoc,symmetric,british]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\makeatletter
\newcommand{\titleallcapsspacing}[1]{\textls[150]{#1}}% adjust this as appropriate
\renewcommand{\maketitlepage}[0]{%
  \cleardoublepage
  {%
    \sffamily
    \begin{fullwidth}%
      \fontsize{18}{20}\selectfont\par\noindent\textcolor{darkgray}{\allcaps{\thanklessauthor}}%
      \vspace{11.5pc}%
      \fontsize{36}{40}\selectfont\par\noindent\textcolor{darkgray}{\titleallcapsspacing{\MakeTextUppercase{\thanklesstitle}}}%
      \if@subtitle
      \smallskip\par
      \LARGE\textcolor{darkgray}{\allcaps{\thanklesssubtitle}}%
      \fi
      \vfill
      \fontsize{14}{16}\selectfont\par\noindent\allcaps{\thanklesspublisher}%
    \end{fullwidth}%
  }
  \thispagestyle{empty}%
  \clearpage
}
\newcommand\@subtitle{}
\newcommand\plainsubtitle{}
\newif\if@subtitle
\newcommand{\subtitle}[2][]{%
  \@subtitletrue
  \gdef\@subtitle{#2}%
  \begingroup
    % TODO store contents of \thanks command
    \renewcommand{\thanks}[1]{}% swallow \thanks contents
    \protected@xdef\thanklesssubtitle{#2}%
  \endgroup
  \ifthenelse{\isempty{#1}}%
  {\renewcommand{\plainsubtitle}{\thanklesstitle}}% use thankless subtitle
  {\renewcommand{\plainsubtitle}{#1}}% use provided plain-text subtitle
}
\makeatother
\title{Sliiightly Long Title}
\subtitle{With A Subtitle}
\begin{document}
\maketitle
\end{document}

An alternative would be to use the changepage package (which is being loaded by the class already) to adjust the margins in \maketitlepage.

Another option would be to just use \includepdf{} and generate the title page separately, doing away with \maketitle altogether. There's no particular reason not to do this. If you just need minor adjustments, that's one thing, but, if you need more radical changes, a separate file may be the way to go. Since the title page is basically one-off, the usual disadvantages of manually specifying the formatting don't apply.

2
  • 1
    Wow, thank you for such a thorough and detailed answer! I've implemented your custom commands and they work like a charm, no more weirdness and it did away with a few other errors at the same time! I've credited and thanked you in my source code too. Jul 20, 2018 at 0:23
  • 1
    @realityChemist I often use subtitles. I tend to use titling with article or book, which makes it a bit easier. But the idea is the same in terms of providing \subtitle and saving the result in case needed later. Glad it helps. (& thanks for the credit!)
    – cfr
    Jul 20, 2018 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.