8

I would like to make my dummy text more distinguishable from the normal text, so I can better determine the progress by making it for example grey?

Can I adjust the \lipsum command, so it applies this behavior every time I use the command?

4
  • Redefine \lipsum by adding \color?
    – user156344
    Commented May 15, 2019 at 15:30
  • It's rather easy to patch the \lipsum command to do so. Which version are you using? (The package had a major update last year.) You can use \listfiles to find out. Commented May 15, 2019 at 15:30
  • @PhelypeOleinik I included \listfiles in the beginning before \documentclass, but where would this output appear? I guess i have the newest version, i am using overleaf with this template: overleaf.com/latex/templates/…
    – Leon D
    Commented May 15, 2019 at 15:40
  • @LeonD The output of \listfiles goes to the log file. You have to (if I'm not mistaken) click the “Logs” button, next to “compile” and then “View raw log”. But overleaf has TeXLive 2017 I think, which contains the older version of lipsum. Commented May 15, 2019 at 15:44

2 Answers 2

8

In newer versions of lipsum, \SetLipsumParListSurrounders is being deprecated, so you can use \setlipsum instead:

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\setlipsum{%
  par-before = \begingroup\color{gray},
  par-after = \endgroup
}
% or:
% \setlipsum{%
%   par-before = \colorlet{oldcolor}{.}\color{gray},
%   par-after = \color{oldcolor}
% }
\begin{document}

Hello

\lipsum[1-2]

Hello hello

\textcolor{red}{Hello again \lipsum[3] and again}

\end{document}

One of the versions above uses \begingroup\color{gray}...\endgroup, which may cause issues with wrapfig. The other version uses two \color commands, which may overflow the colour stack if used too often.

And for older versions of lipsum, which don't have \SetLipsumParListSurrounders

\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}

\makeatletter
\renewcommand\lips@dolipsum{%
  \ifnum\value{lips@count}<\lips@max\relax
    \addtocounter{lips@count}{1}%
    \begingroup
      \color{gray}% <--- Change color here
      \csname lipsum@\romannumeral\c@lips@count\endcsname
    \endgroup
    \expandafter\lips@dolipsum
  \fi
}
\makeatother

\begin{document}

Hello

\lipsum[1-2]

Hello hello

\textcolor{red}{Hello again \lipsum[3] and again}

\end{document}
4
  • Works nice, thank you. Only sideeffect: \lipsum without the brackets gives me many paragraphs of dummy text, not only one, so i have to add [1] afterwards.
    – Leon D
    Commented May 15, 2019 at 21:36
  • 1
    @LeonD It's not a side effect, but a feature of the package which exists even without this patch. If you don't say how many paragraphs you want the package defaults to 1-7, so \lipsum gives the same as \lipsum[1-7]. You can change that with \setlipsumdefault{1}, for example, to give only the first paragraph or \setlipsumdefault{1-3} to give the first three. Commented May 15, 2019 at 21:40
  • Thanks for the really friendly and quick help!
    – Leon D
    Commented May 15, 2019 at 21:56
  • 1
    @LeonD You're welcome :-) Commented May 15, 2019 at 21:57
10

How about

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\SetLipsumParListSurrounders{\colorlet{oldcolor}{.}\color{gray}}{\color{oldcolor}}
\begin{document}
Hello

\lipsum[1-2]

Hello hello

\textcolor{red}{Hello again \lipsum[3] and again}
\end{document}

enter image description here

EDIT: @egreg kindly pointed out a simpler solution:

\SetLipsumParListSurrounders{\begingroup\color{gray}}{\endgroup}

Apart from being simpler it also avoids overwriting oldcolor which some other macro might be using.

4
  • 2
    Nice, but Overleaf :/ Commented May 15, 2019 at 15:48
  • 2
    @PhelypeOleinik Oh, I didn't pay attention on this. ;-) In a few years it will work with overleaf, too, I suppose. ;-) (IMHO this reiterates this concern if there is a problem, and if there is no problem there is no problem. ;-)
    – user121799
    Commented May 15, 2019 at 15:51
  • 2
    Wouldn't \SetLipsumParListSurrounders{\begingroup\color{gray}}{\endgroup} be simpler?
    – egreg
    Commented May 15, 2019 at 16:06
  • @egreg Probably it would, mille grazie!
    – user121799
    Commented May 15, 2019 at 16:17

You must log in to answer this question.

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