8

I am writing a two-column document and I have a problem with a section which produces an underfull box. What is the correct way (or some better ways) to typeset such a section so to have a beautiful output? This can be regarded as a general question as to what someone must do in such a case.

enter image description here

\documentclass{article}

\usepackage[top=0.7in, bottom=1.2in, left=0.8in, right=0.8in]{geometry}
\usepackage{parskip}
\setlength{\parindent}{0cm}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{fontspec}
\usepackage[greek,english]{babel}
\usepackage[fontsize=8pt]{scrextend}
\usepackage{multicol}

\setmainfont[Ligatures=TeX, Extension=.otf, UprightFont=*, BoldFont=*Bold, ItalicFont=*It, BoldItalicFont=*BoldIt, Mapping=tex-text]{GFSArtemisia}
\setsansfont[Mapping=tex-text]{GFSArtemisia.otf}
\setmathfont{latinmodern-math.otf}
\setmathfont[range=\varnothing]{Asana-Math.otf}
\setmathfont[range=\int]{latinmodern-math.otf}

\begin{document}

\selectlanguage{greek}

\begin{multicols*}{2}

\section{ΑΝΤΙΣΤΡΟΦΟΣ ΜΕΤΑΣΧΗΜΑΤΙΣΜΟΣ Ζ}

\end{multicols*}

\end{document}
  • I often see two-column docs with a ragged edge – that will likely get rid of the warning you're seeing (and the section title will look loads better) – Sean Allred Jun 12 '15 at 3:08
  • @SeanAllred I see what you mean in the answer. It is pretty nice. Thanks. – Adam Jun 13 '15 at 23:03
6

As Sean mentioned in comment, it would look much nicer if set flushed to the left (ragged right). Here are two examples. One with \raggedright and one with \RaggedRight from ragged2e The second one allows hyphenation.

% arara: lualatex

\documentclass{article}
\usepackage[top=0.7in, bottom=1.2in, left=0.8in, right=0.8in]{geometry}
\setlength{\parindent}{0cm}
\usepackage{fontspec}
\usepackage[greek,english]{babel} % load after fontspec
\setmainfont[Ligatures=TeX, Extension=.otf, UprightFont=*, BoldFont=*Bold, ItalicFont=*It, BoldItalicFont=*BoldIt, Mapping=tex-text]{GFSArtemisia}
\usepackage[fontsize=8pt]{scrextend}
\usepackage{multicol}
\usepackage{ragged2e} % for \RaggedRight
\usepackage{titlesec}
\titleformat{\section}
%{\normalfont\Large\bfseries\raggedright}{\thesection}{1em}{} % chose the one you like
{\normalfont\Large\bfseries\RaggedRight}{\thesection}{1em}{}
\usepackage{blindtext} % only for demo
\usepackage{microtype} % always recommended

\begin{document}
    \selectlanguage{greek}  
    \begin{multicols*}{2}
        \section{ΑΝΤΙΣΤΡΟΦΟΣ ΜΕΤΑΣΧΗΜΑΤΙΣΜΟΣ Ζ}
        \Blindtext
    \end{multicols*}
\end{document}

\raggedright:

enter image description here

\RaggedRight:

enter image description here


As mentioned by egreg, you may use \usepackage{sectsty}\allsectionsfont{\RaggedRight} instead. This will be the shortest way, in case you do not want to change other properties of your section command.

  • 2
    With sectsty it's simpler: \allsectionsfont{\raggedright}. This assumes one doesn't want to change other aspects in the typesetting of section titles. – egreg Jun 12 '15 at 10:43
3

Since you are using scrextend package, why not use scrartcl directly?

With the KOMA-Script features, this is a one liner \addtokomafont{disposition}{\raggedright}.

Here's a full example (I also removed the parskip package, since that's an option of the scr packages, too). Also note that the optional argument in \setmainfont is after the name of the font \setmainfont{<font>}[<config>].

\documentclass[fontsize=8pt,parskip=half]{scrartcl}

\usepackage[top=0.7in, bottom=1.2in, left=0.8in, right=0.8in]{geometry}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{fontspec}
\usepackage[greek,english]{babel}
\usepackage{multicol}

\setmainfont{Latin Modern Roman}[Ligatures=TeX]
\setmathfont{Latin Modern Math}

\addtokomafont{disposition}{\raggedright}

\begin{document}

\selectlanguage{greek}

\begin{multicols*}{2}

\section{ΑΝΤΙΣΤΡΟΦΟΣ ΜΕΤΑΣΧΗΜΑΤΙΣΜΟΣ Ζ}

\end{multicols*}

\end{document}
  • Even more, it's \raggedright by default. – Manuel Jun 12 '15 at 14:08

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.