4

My problem: There's more space before my \chapter that's inside a \minipage environment than before any of the other chapters that are outside this environment.

What I'm after: Keep the same distance before every chapter. However, I'd like to keep the two chapers within the two minipages as they are (i.e. vertically aligned).

I'm using LuaLaTex-->PDF in order to use the Arial font, although that might be irrelevant.

I'd happily use any other solution that does not involve minipage if that is possible.

My MWE (using LuaLaTex-->PDF)

\documentclass[a4paper,10pt]{report}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[top=20mm, bottom=20mm, left=20mm, right=20mm]{geometry}

\setmainfont{Arial}

\newfontfamily\secfont{Arial}

\definecolor{MSBlue}{rgb}{.204,.353,.541}
\definecolor{MSLightBlue}{rgb}{.31,.506,.741}
\definecolor{light-gray}{gray}{0.5}

\usepackage{sectsty}
\allsectionsfont{\secfont}

\usepackage{titlesec}
\newcommand{\hsp}{\hspace{0pt}}

\titlespacing*{\chapter}{0cm}{0.7cm}{0.2cm}[0pt]
\titlespacing*{\section}{0cm}{0.5cm}{0cm}[0pt]

\titleformat{\chapter}{\normalsize\bfseries\secfont\color{MSBlue}}{\hsp}{0pt}{\normalsize\bfseries\color{MSBlue}}[\vspace{0ex}\titlerule]
\titleformat{\section}{\large\bfseries\secfont}{\hsp}{0pt}{\large\bfseries}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother

\begin{document}
\pagestyle{empty}
\pagenumbering{gobble}

\chapter{Some chapter}
\section{some section}
{\color{light-gray}some small text}\\
\blindtext

\chapter{Some other chapter}
\section{some other section}
{\color{light-gray}Some small text}\\%
\blindtext%
\par\smallskip\nointerlineskip%
\noindent\begin{minipage}[t]{0.5\textwidth}
\chapter{Here it is} %                      <--- The culprit!
\begin{tabular}{l l}
    \small 
            \textbf{cell1}  &| cell6 \\
            \textbf{cell2}  &| cell7 \\
            \textbf{cell3}  &| cell8 \\
            \textbf{cell4}  &| cell9 \\
            \textbf{cell5}  &| cell10
\end{tabular}%
\end{minipage}%
%
\begin{minipage}[t]{0.5\textwidth}
    \chapter{And the other one}
    \small 
    Writing some text here
\end{minipage}%

\chapter{The next chapter}
\blindtext

\end{document}    
  • 1
    ! Undefined control sequence. l.12 \definecolor – David Carlisle Aug 27 '13 at 21:23
6

If you add

\showoutput
\showboxdepth6

You will see (xetex version luatex would be similar)

that the space above a normal chapter comes from

...\glue 19.91684
...\glue 0.0
...\special{color push rgb .204 .353 .541}
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 1.49556

whereas the space above your boxed chapter pair is

...\glue 3.0 plus 1.0 minus 1.0
...\glue 0.0
...\glue(\parskip) 0.0 plus 1.0
...\hbox(0.0+98.0073)x483.69687
....\vbox(0.0+98.0073)x241.84843
.....\write1{\@writefile{toc}{\protect \contentsline {chapter}{\protect \number
line \ETC.}
.....\write1{\@writefile{lof}{\protect \addvspace {10\p@ }}}
.....\write1{\@writefile{lot}{\protect \addvspace {10\p@ }}}
.....\rule(0.0+0.0)x*
.....\penalty 10000
.....\glue 19.91684
.....\glue 0.0
.....\special{color push rgb .204 .353 .541}
.....\glue(\parskip) 0.0

The only real difference that I can see is

...\glue 3.0 plus 1.0 minus 1.0

which is exactly

\smallskip

so you want to remove that from your definition.

Normally there would be difference in stretch glue between the boxed and unboxed headings, but your chapter space is fixed and does not have a stretch or shrink component, so you do not have that worry.

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.