3

I'm trying to justify the initial quote in moderncv package. And the following answer seems to provide a proper solution: https://tex.stackexchange.com/a/440444/192035

However, when I try to replace the text generated with lipsum with actual text, the justify aligment is lost. Trying to understand the reason, I found that lipsum doesn't add plain text, but it also adds some extra formatting. However, I not able to fully understand the problem and how to solve it.

This is the solution using lipsum:

\documentclass[12pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}                            
\moderncvcolor{blue}                               
\usepackage[utf8]{inputenc}                     
\usepackage[scale=0.75]{geometry}
\name{first}{last}

\usepackage{ragged2e} % provides \justifying
\renewcommand*{\quotefont}{\large\slshape\justifying}

\usepackage{lipsum}

\quote{\lipsum[2]}

\begin{document}

\makecvtitle

\end{document}

enter image description here

And here the problem after replacing lipsumgenerated text with actual text:

\documentclass[12pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}                            
\moderncvcolor{blue}                               
\usepackage[utf8]{inputenc}                     
\usepackage[scale=0.75]{geometry}
\name{first}{last}

\usepackage{ragged2e} % provides \justifying
\renewcommand*{\quotefont}{\large\slshape\justifying}

\quote{Lorem ipsum dolor sit amet, dicant civibus ius an. Mel te minim urbanitas forensibus, ad vel probatus eloquentiam, an per accusam noluisse. Cum brute mollis conceptam ne, vel inani theophrastus at. Discere mediocrem intellegebat vis at, atqui error no sit.
Ea sit ferri fierent argumentum, stet philosophia eu quo. Vix tantas eligendi perpetua ne, tale mazim liber vel ne, eam ad suscipit gloriatur. Nec ut sonet nonumes democritum, inani labore admodum eu est. Mea ea cetero luptatum posidonium, in probo exerci eam.}

\begin{document}

\makecvtitle

\end{document}

enter image description here

  • 2
    I think \lipsum adds a paragraph break at the end, try ending your quote text with \par. – Torbjørn T. Jul 1 at 11:10
  • Many thanks for the suggestion, it was the only thing I tried before posting the question, but I didn't describe it in the question because I don't fully understant what \par does. Anyway, it doesn't fix the problem. – Pablo EM Jul 1 at 11:35
10

I get centering also with \lipsum, with a recent version, because lipsum no longer adds \par at the end of its paragraphs, but at the beginning.

The problem is with \makecvtitle typesets the text stored in \@quote inside an unnecessary group. Unfortunately, doing

\quote{stuff\par}

isn't going to work, because \quote is not a “long” command. What happens is that \makecvtitle does \makecvhead, which in turn does

\ifthenelse{\isundefined{\@quote}}
  {}
  {{\null \hfill \begin {minipage}{\quotewidth }\centering \quotestyle {\@quote }\end{minipage}...

and \quotestyle is defined as

{\quotefont \textcolor {color1}{#1}}

with an additional brace level. Thus \justifying is undone before minipage ends, and you get the default \centering.

Workaround: redefine \quotestyle to suppress the additional braces.

\documentclass[12pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\name{first}{last}

\usepackage{ragged2e} % provides \justifying
\renewcommand*{\quotefont}{\large\slshape\justifying}
\renewcommand{\quotestyle}[1]{\quotefont\color{color1}#1}

\usepackage{lipsum}

\quote{\lipsum[2]}

\begin{document}

\makecvtitle

\end{document}
  • \quote{stuff\endgraf} works too. – Ulrike Fischer Jul 1 at 15:13
  • @UlrikeFischer Yes, but I wouldn't advertise it. It's better to fix the wrong definition of \quotestyle. – egreg Jul 1 at 15:27
4

Directly adding \par seems not to work, but outsourcing the text in a new command seems to do the trick:

\documentclass[12pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}                            
\moderncvcolor{blue}                               
\usepackage[utf8]{inputenc}                     
\usepackage[scale=0.75]{geometry}
\name{first}{last}

\usepackage{ragged2e} % provides \justifying
\renewcommand*{\quotefont}{\large\slshape\justifying}

\newcommand{\quotetext}{Lorem ipsum dolor sit amet, dicant civibus ius an. Mel te minim urbanitas forensibus, ad vel probatus eloquentiam, an per accusam noluisse. Cum brute mollis conceptam ne, vel inani theophrastus at. Discere mediocrem intellegebat vis at, atqui error no sit.
Ea sit ferri fierent argumentum, stet philosophia eu quo. Vix tantas eligendi perpetua ne, tale mazim liber vel ne, eam ad suscipit gloriatur. Nec ut sonet nonumes democritum, inani labore admodum eu est. Mea ea cetero luptatum posidonium, in probo exerci eam.\par}

\quote{\quotetext}

\begin{document}

\makecvtitle

\end{document}
  • 1
    Many thanks for the quick response! It works as expected. However, let me accept @egreg's response since he provides a more detailed explanation of the problem and why the solution works. – Pablo EM Jul 1 at 11: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.