TransWikia.com

How to reduce the vertical empty space height/space of the center environment with huge text?

TeX - LaTeX Asked on January 19, 2021

This famous question explains how you can reduce the empty useless spacing between listings or so, but now I’d like to do the same with center, which also has a big space here:

documentclass{scrartcl}
parskip3mm
parindent0mm % if you want to have no lineskip

usepackage{roboto} % font

usepackage{lipsum}

begin{document}
lipsum[1]:

begin{center}
    huge
    robotoMedium{OBJECTION}
end{center}

lipsum[1]

lipsum[1]

end{document}

preview

My aim is that it should read similar as if it was nearly one sentence, i.e.

Here I am describing my:
Objection

I.e. the new line, size and centering should just be some highlighting, but not indicate a new paragraph e.g.

Tries

Of course I already tried the same solution as explained in the linked SE answer:

documentclass{scrartcl}
parskip3mm
parindent0mm % if you want to have no lineskip

newenvironment{centerCompact}
{ begin{center}
    setlength{itemsep}{0pt}
    setlength{parskip}{0pt}
    setlength{parsep}{0pt}     }
{ end{center}                  } 


usepackage{roboto} % font

usepackage{lipsum}

begin{document}
lipsum[1]:

begin{centerCompact}
    huge
    robotoMedium{OBJECTION}
end{centerCompact}

lipsum[1]

lipsum[1]

end{document}

It improves the situation a bit, but does not fully solve it:
preview 2

It’s still too much.

2 Answers

Of course, you can use vspace to workaround that, I just doubt it is the best solution:

documentclass{scrartcl}
parskip3mm
parindent0mm % if you want to have no lineskip

usepackage{roboto} % font

usepackage{lipsum}

begin{document}
lipsum[1]:

begin{center}
    vspace{-20pt}
    huge
    robotoMedium{OBJECTION}
    vspace{-10pt}
end{center}

lipsum[1]

lipsum[1]

end{document}

preview

Answered by rugk on January 19, 2021

Firstly, you comment that you do not want it to appear as a separate paragraph, but you are explicitly marking a paragraph break before and after the centered text (which adds extra vertical space amongst other things) so removing that helps.

Then center is a one item list and lists are set off with topsep vertical spacing so setting that to 0pt makes a tighter display.

Alternatively, for single line entries as shown in the second form you can keep it all in the same paragraph at the tex level using rather than a display environment, and centering with makebox.

enter image description here

documentclass{scrartcl}
parskip3mm
parindent0mm % if you want to have no lineskip ??? (this doesn't affect lineskip)

usepackage{roboto} % font
setlengthtopsep{0pt}
usepackage{lipsum}

begin{document}
lipsum[1]:
begin{center}
    huge
    robotoMedium{OBJECTION}
end{center}
lipsum[1]:[5pt]
makebox[textwidth]{HugerobotoMedium{OBJECTION}}
lipsum[1]

lipsum[1]

end{document}

Answered by David Carlisle on January 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP