5

I need to center a justified paragraph, 80% of total textwidth while preserving perfect alignment with the underlying baseline grid.

I can get the desidered size and centering, but not the alignment with underlying grid.

See MWE below. I need to have the second sample align to the grid exactly like the first sample.

This is what I have so far:

\documentclass[12pt]{report}
\usepackage{vgrid}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non
vulputate neque, sit amet dictum dolor. Vestibulum auctor ante nec arcu 
faucibus lacinia. Curabitur interdum rhoncus magna feugiat dapibus. Nulla 
ac metus quis felis gravida placerat. Aliquam dignissim magna id nibh 
bibendum dignissim.

{\centering
\begin{minipage}{.8\textwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non
vulputate neque, sit amet dictum dolor. Vestibulum auctor ante nec arcu 
faucibus lacinia. Curabitur interdum rhoncus magna feugiat dapibus. Nulla 
ac metus quis felis gravida placerat. Aliquam dignissim magna id nibh 
bibendum dignissim.
\end{minipage}
\par}

\end{document}

Which gives the following:

enter image description here

How can one center a justified 80%-width paragraph while preserving perfect grid alignment?

3

Using @egreg's answer (all credit goes to him, but this is too long for a comment):

You can define a minipage* environment as follows, which should not mess up your vertical grid:

\newenvironment{minipage*}[2][t]
    {\minipage[#1]{#2}}
    {\par\xdef\tpd{\the\prevdepth}\endminipage\par\prevdepth\tpd}

Do not redefine the original minipage environment, as it will interfere with other packages using it.

  • 1
    Thank you, this solution works well too, and with any baseline. I appreciate the link to Prof Gregorio's authoritative answer. Thanks. – gsl Apr 9 '18 at 7:45
4

yet another way to manage indented margins without "going off the grid".

the blank line at the end of the indented group can be replaced by \par. just remember that modifications to the "incoming" text format don't take effect until the next paragraph break.

\documentclass[12pt]{report}
\usepackage{vgrid}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non
vulputate neque, sit amet dictum dolor. Vestibulum auctor ante nec arcu 
faucibus lacinia. Curabitur interdum rhoncus magna feugiat dapibus. Nulla 
ac metus quis felis gravida placerat. Aliquam dignissim magna id nibh 
bibendum dignissim.

\begingroup
\setlength{\leftskip}{.1\textwidth}
\setlength{\rightskip}{\leftskip}
\noindent
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non
vulputate neque, sit amet dictum dolor. Vestibulum auctor ante nec arcu 
faucibus lacinia. Curabitur interdum rhoncus magna feugiat dapibus. Nulla 
ac metus quis felis gravida placerat. Aliquam dignissim magna id nibh 
bibendum dignissim.

\endgroup

\end{document}

output of example code

3

If ad hoc solutions are allowed...

You can see from the results of the code that \baselineskip is equal to 14.5 pt for 12 pt font. So adding the difference locally solves the problem.

\documentclass[12pt]{report}
\usepackage{vgrid}

\begin{document}
\the\baselineskip

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non
vulputate neque, sit amet dictum dolor. Vestibulum auctor ante nec arcu 
faucibus lacinia. Curabitur interdum rhoncus magna feugiat dapibus. Nulla 
ac metus quis felis gravida placerat. Aliquam dignissim magna id nibh 
bibendum dignissim.


{\centering\vspace{2.5pt}
\begin{minipage}{.8\textwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non
vulputate neque, sit amet dictum dolor. Vestibulum auctor ante nec arcu 
faucibus lacinia. Curabitur interdum rhoncus magna feugiat dapibus. Nulla 
ac metus quis felis gravida placerat. Aliquam dignissim magna id nibh 
bibendum dignissim.
\end{minipage}
\par}

\end{document}

enter image description here

  • Thank you, that works perfectly. It is fine with me to have ad-hoc solution, although I have to confront with the use-case in question with a few different templates (prose, poetry, theatre), using different baseline. I wish though StackExchange would allow to pick 2 answers as accepted, as this one is very clear, practical and immediate, the second one is more general. Thank you. – gsl Apr 9 '18 at 7:42

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.