Regression: \newline in cvitemwithcomment not working from v2.0.0
Nodraak opened this issue · 5 comments
Hi!
I just reinstalled my whole system yesterday (Debian 9 Stretch) and found a regression when compiling my resume. The bug was introduced in moderncv between these two version:
- moderncv 2015/07/28 v2.0.0:
\newline
not working (also, the text is not bold anymore) - moderncv 2013/04/29 v1.5.1: ok,
\newline
create a line break as expected
Minimal example:
\documentclass[11pt, a4paper]{moderncv}
\usepackage[utf8]{inputenc}
\moderncvstyle{classic}
\moderncvcolor{blue}
\firstname{first}
\familyname{last}
\begin{document}
\cvitemwithcomment{2016-2017}{ Lorem ipsum dolor sit amet, consectetur adipiscing elit. \newline Donec efficitur rutrum nisl, quis sodales mi mattis eget.}{}
\end{document}
Some more info (not sure if usefull ...)
tree
's output for moderncv v2.0.0 installed with tlmgr
:
$ tree ~/texmf/
/home/nodraak/texmf/
├── tex
│ └── latex
│ ├── framed
│ │ └── framed.sty
│ └── moderncv
│ ├── moderncvbodyiii.sty
│ ├── moderncvbodyii.sty
│ ├── moderncvbodyi.sty
│ ├── moderncvbodyiv.sty
│ ├── moderncvbodyv.sty
│ ├── moderncv.cls
│ ├── moderncvcollection.sty
│ ├── moderncvcolorblack.sty
│ ├── moderncvcolorblue.sty
│ ├── moderncvcolorburgundy.sty
│ ├── moderncvcolorgreen.sty
│ ├── moderncvcolorgrey.sty
│ ├── moderncvcolororange.sty
│ ├── moderncvcolorpurple.sty
│ ├── moderncvcolorred.sty
│ ├── moderncvcompatibility.sty
│ ├── moderncvdebugtools.sty
│ ├── moderncvfooti.sty
│ ├── moderncvheadiii.sty
│ ├── moderncvheadii.sty
│ ├── moderncvheadi.sty
│ ├── moderncvheadiv.sty
│ ├── moderncvheadvi.sty
│ ├── moderncvheadv.sty
│ ├── moderncviconsawesome.sty
│ ├── moderncviconsletters.sty
│ ├── moderncviconsmarvosym.sty
│ ├── moderncvstylebanking.sty
│ ├── moderncvstylecasual.sty
│ ├── moderncvstyleclassic.sty
│ ├── moderncvstyleempty.sty
│ ├── moderncvstylefancy.sty
│ ├── moderncvstyleoldstyle.sty
│ └── tweaklist.sty
├── tlpkg
│ ├── texlive.tlpdb
│ └── tlpobj
│ ├── 00texlive.installation.tlpobj
│ ├── framed.tlpobj
│ └── moderncv.tlpobj
└── web2c
└── tlmgr.log
tree
's output for moderncv v1.5.1 installed manually:
$ tree ~/texmf/
/home/nodraak/texmf/
├── tex
│ └── latex
│ ├── base
│ │ └── moderncv.cls
│ ├── framed
│ │ └── framed.sty
│ └── moderncv
│ ├── moderncvcollection.sty
│ ├── moderncvcolorblack.sty
│ ├── moderncvcolorblue.sty
│ ├── moderncvcolorgreen.sty
│ ├── moderncvcolorgrey.sty
│ ├── moderncvcolororange.sty
│ ├── moderncvcolorpurple.sty
│ ├── moderncvcolorred.sty
│ ├── moderncvcompatibility.sty
│ ├── moderncviconsawesome.sty
│ ├── moderncviconsletters.sty
│ ├── moderncviconsmarvosym.sty
│ ├── moderncvstylebanking.sty
│ ├── moderncvstylecasual.sty
│ ├── moderncvstyleclassic.sty
│ ├── moderncvstyleempty.sty
│ ├── moderncvstyleoldstyle.sty
│ └── tweaklist.sty
├── tlpkg
│ ├── texlive.tlpdb
│ └── tlpobj
│ ├── 00texlive.installation.tlpobj
│ └── framed.tlpobj
└── web2c
└── tlmgr.log
Fresh system install from yesterday:
- os: debian 9 stretch
- latex: debian's default package texlive:
$ pdflatex -v
pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian)
kpathsea version 6.2.2
[... legal disclaimers ...]
Compiled with libpng 1.6.28; using libpng 1.6.28
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with poppler version 0.48.0
I believe here is the diff that introduced the bug (I grep
'ed for \cvitemwithcomment
in both version and diff
'ed the result):
2,4c2,4
< \savebox{\cvitemwithcommentmainbox}{{\bfseries#3}}%
< \setlength{\cvitemwithcommentmainlength}{\widthof{\usebox{\cvitemwithcommentmainbox}}}%
< \setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentmainlength}%
---
> \savebox{\cvitemwithcommentbox}{{#3}}%
> \setlength{\cvitemwithcommentskilllength}{\widthof{\usebox{\cvitemwithcommentbox}}}%
> \setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentskilllength}%
6c6
< \begin{minipage}[t]{\cvitemwithcommentmainlength}\bfseries#3\end{minipage}%
---
> \begin{minipage}[t]{\cvitemwithcommentskilllength}\usebox{\cvitemwithcommentbox}\end{minipage}%
I conclude that \usebox
prevent the use of line break. Here is a random stackoverflow link that seems to be relevant.
I think this is the commit that introduced the use of \usebox
: f50d1cf
I can confirm I am having the same problem. It also applies to the cventry command.
Does anybody have a workaround?
Try loading the makecell package (\usepackage{makecell}
in the preamble), then inside the braces you want to have a newline, change {this is a very very very very long line}
to {\makecell[tl]{this is a very very very \\ very long line}}
. The [tl]
means justify to top and left, you can use t
op, c
entre, b
ottom, l
eft, or r
ight for these (vertical justification comes first).
Workaround works. Is there a way to have automatic linebreaks within the comment?