2

Background

I'm typesetting a book for which I use twocolumn declaration in the documentclass (it's a very long science book with many tables and figures so I didn't want to redeclare the twocolumn env. after every fullwidth image/table so I chose the document class way).

The problem

At the start of each chapter, there's a quote which I would like to keep onecolumn (ie. at the width of \textwidth), so I don't have it only in the 1st column but rather above both of the columns. So far I've tried minipage environment and \parbox which both do give me a box with width of \textwidth, but the second column isn't pushed lower beneath the quote box so it overflows it. When I've tried a hack using

\begin{table*}
The text of the quote
\endtable*}

the quote displayed as I wanted above both columns but at the next page, not right under the chapter heading. When I've tried to use \Floatbarrier from placeins package, the 2nd column overflown the quote as with the other solutions.

My current setup (posting only MWE here, I have lots of other packages loaded which, I believe, are irrelevant to this) which gives me the undesired result of the quote being in only the 1st column, not above both the columns, is this:

\documentclass[a4paper,10pt,openany,twoside,twocolumn]{book}
\usepackage[inner=3cm,outer=2cm, top=2cm]{geometry}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{dblfloatfix} 
\usepackage{lipsum} % using only for this MWE

\begin{document}
    \chapter{Lorem ipsum sit dolor amet} % (fold)
        \textit{This is the text of a very insightful and deep quote that affects lives of all beings.}
        \begin{flushright}
            Konfucius
        \end{flushright}
        \medskip
        \lipsum[1-6]
\end{document}

Which results in this when compiled in Lualatex:

enter image description here

Question

Is there any way I can produce this desired result in Latex?

enter image description here

Thanks a lot for your help.

0

3 Answers 3

3

With use of the macro strip from the package cuted:

\documentclass[a4paper,10pt,openany,twoside,twocolumn]{book}
\usepackage[inner=3cm,outer=2cm, top=2cm]{geometry}
\usepackage{lmodern}
\usepackage[english]{babel}
%\usepackage{dblfloatfix} 
\usepackage{cuted}  % <---

\usepackage{lipsum} % using only for this MWE

\begin{document}
    \chapter{Lorem ipsum sit dolor amet} % (fold)
    \begin{strip}   % <---
        \textit{This is the text of a very insightful and deep quote that affects lives of all beings.}
        \begin{flushright}
            Konfucius
        \end{flushright}
    \end{strip}    % <---
        \medskip
        \lipsum[1-6]
\end{document}

enter image description here

4
  • Thanks, this is the simplest solution to my problem which works like a charm and since the 2 first answers are essentially the same, I'm accepting yours because it came earlier. Thanks a lot for your help :)
    – edison23
    Aug 23, 2019 at 15:28
  • 1
    Note: in Lualatex 1.10.0 (TeX Live 2019/Debian), there need to be empty lines around the \epigraph{}{} line, otherwise Lualatex will throw an arror: ! You can't use \prevdepth in horizontal mode. \nointerlineskip ->\prevdepth
    – edison23
    May 3, 2020 at 13:03
  • @edison23 Is this a bug? In any case thank you! May 15, 2020 at 15:01
  • No, that's not a bug. LaTeX needs to be in vertical mode when it's handling vertical spacing. If you don't add the blank lines, LaTeX stays in horizontal mode, hence the error. (But I have no idea why older versions of LuaLaTeX didn't require this... so yes, there might be some bug around but I feel it might rather be in the older versions.)
    – edison23
    Jun 9, 2020 at 8:03
2

In addition to the strip environment, I would recommend using the epigraph package, which can easily be adapted to your taste:

\documentclass[a4paper,10pt,openany,twoside,twocolumn]{book}
\usepackage[inner=3cm,outer=2cm, top=2cm]{geometry}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{dblfloatfix}
 \usepackage{cuted}
 \usepackage{epigraph}
 \setlength{\epigraphwidth}{0.75\textwidth}
 \renewcommand{\textflush}{flushright}
 \setlength{\epigraphrule}{0pt}
 \setlength{\beforeepigraphskip}{0pt}
 \setlength{\afterepigraphskip}{0pt}

\usepackage{lipsum} % using only for this MWE

\begin{document}

    \chapter{Lorem ipsum sit dolor amet} % (fold)

\begin{strip}
\epigraph{\itshape This is the text of a very insightful and deep quote that affects lives of all beings.}{Konfucius}
\end{strip}
        \lipsum[1-6]

\end{document} 

enter image description here

4
  • Thanks for your answer, the strip environment works like a charm and thanks for proposing the epigraph but is there a way I can make the horizontal line between the quote and the author only e.g. 0.4\textwidth wide?
    – edison23
    Aug 23, 2019 at 15:36
  • 1
    Yes, in several ways. For instance you can remove the line \setlength{\epigraphrule}{0pt} in your preamble and replace it with: \makeatletter \renewcommand{\@epirule}{\rule[.5ex]{0.4\textwidth}{\epigraphrule}} \makeatother
    – Bernard
    Aug 23, 2019 at 15:50
  • Thanks, I've modified the setting so it aligns the rule to the right: \makeatletter \renewcommand{\@epirule}{\begin{flushright}\rule[.5ex]{0.4\textwidth}{\epigraphrule}\end{flushright}} \makeatother
    – edison23
    Aug 25, 2019 at 18:34
  • I also added negative 1.5em vertical space to remove the big margin above the rule - \vspace{-1.5em} - but that's just a matter of taste
    – edison23
    Aug 25, 2019 at 18:55
1

This solution modifies \@makechapterhead to include the quote, which is stored in a savebox ahead of time by \chapterquote.

Note that flushright is a list and adds extra space above and below, where as \makebox does not.

\documentclass[a4paper,10pt,openany,twoside,twocolumn]{book}
\usepackage[inner=3cm,outer=2cm, top=2cm]{geometry}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{dblfloatfix} 
\usepackage{lipsum} % using only for this MWE

\newsavebox{\quotebox}

\newcommand{\chapterquote}[2]% #1==quote, #2=credit
{\savebox{\quotebox}{\parbox{\textwidth}{\centering\textit{#1}\\%
  \ifx\empty#2\relax\else \makebox[\textwidth][r]{#2}\fi}}\ignorespaces}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@ % gap below title
    \ifvoid\quotebox\else
      \box\quotebox
      \bigskip
    \fi
  }}
\makeatother

\begin{document}
    \chapterquote{This is the text of a very insightful and deep quote that affects lives of all beings.}%
        {Konfucius}%
    \chapter{Lorem ipsum sit dolor amet}%
    \lipsum[1-6]
\end{document}

One can simplify the code somewhat by using the etoolbox package to edit \@makechapterhead.

\makeatletter
\patchcmd{\@makechapterhead}{\vskip 40\p@}{%
  \vskip 40\p@ % gap below title
  \ifvoid\quotebox\else
    \box\quotebox
    \bigskip
  \fi}{}{}
\makeatother
3
  • Thanks, but this solution is unnecessarily complicated for my usecase... but it may certainly be useful for some other people.
    – edison23
    Aug 23, 2019 at 15:37
  • Technically, the \@makechapterhead definition is already in your code, you just can't see it. Aug 23, 2019 at 15:45
  • I know it's there but it's just easier for me to do it using the strip environment. There might be cases where I don't have a quote for a chapter and then I'd have to fiddle with the chapter definition again. Anyway, thanks for pointing out the fact about flushright adding margins and possibility to use makebox, it's actually better that way :)
    – edison23
    Aug 23, 2019 at 15:48

You must log in to answer this question.

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