TeX - LaTeX Asked by Douglas De Rizzo Meneghetti on August 27, 2021
I want to set linespread to a value then go back to the previous value it had. How do I do it?
Something like:
letoldlinespreadlinespreadvalue
linespread{1}
printmystuff
linespread{oldlinespread}
The value is stored as baselinestretch
. However, your code would need something additional:
letsavedbaselinestretchbaselinestretch
linespread{1}selectfont
<My stuff>
linespread{savedbaselinestretch}selectfont
The blank lines are necessary.
A better way out is to use an environment:
newenvironment{normalspread}
{parlinespread{1}selectfont}
{par}
begin{normalspread}
<My stuff>
end{normalspread}
However, this would leave uneven spacing around the part with linespread{1}
(as would the naive code above.
A better example:
documentclass{article}
usepackage{lipsum}
newenvironment{normalspread}
{paraddvspace{medskipamount}linespread{1}selectfont}
{par}
linespread{1.5}
begin{document}
lipsum[1][1-6]
begin{normalspread}
lipsum[2]
end{normalspread}
lipsum[3][1-6]
end{document}
but the spacing has been added “by eye”.
Something better can be obtained with setspace
.
documentclass{article}
usepackage{setspace}
usepackage{lipsum}
onehalfspacing
begin{document}
lipsum[1][1-6]
begin{singlespace}
lipsum[2]
end{singlespace}
lipsum[3][1-6]
end{document}
Correct answer by egreg on August 27, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP