4

I'm adding a colophon at the end of my document inside a \shapepar, however it appears at the top left of the page, and I can't manage to center it, both horizontally and vertically.

I've loaded the geometry options I'm loading for my document, but I removed basically all the preamble and a lot of packages that didn't seem to influence the positioning of the colophon.

Without the geometry package, it is somewhat centered but it still looks more to the left. Note that I included margins and a \newgeometry command to set the same margins for this page only, to simulate what happens in my actual document.

What's the most appropriate way to center it?

MWE

\documentclass[12pt, twoside]{article}
\usepackage[a4paper, margin=2.5cm,bindingoffset=1.5cm, showframe]{geometry}
\usepackage{shapepar}

    \def\triangledownshape{%
    {0}%
    {0}b{0}\\%
    {0}t{-10}{20}\\%
    %{8.66}t{-5}{10}\\%
    {17.32}e{0}%
    }
    \def\triangledownpar#1{\Shapepar\triangledownshape #1\unskip\ .\par}

\begin{document}

\newgeometry{margin=2cm}
\triangledownpar{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut porttitor magna posuere tristique interdum. Maecenas ac nisi rutrum, tincidunt ante a, cursus est. Pellentesque dui ligula, maximus quis viverra sit amet, cursus sed urna. Donec eu erat sed justo cursus tristique non quis nisi. Suspendisse dapibus lorem nec laoreet interdum. Duis sit amet leo sagittis, tincidunt elit in, imperdiet diam. Nulla mi justo, tincidunt a ullamcorper eget, consequat ut odio. Aliquam erat volutpat. Suspendisse potenti. Aenean tristique arcu orci, sit amet dignissim ligula elementum vitae. Praesent auctor augue eu lacus tempor maximus. Quisque auctor, odio eu laoreet congue, mi massa facilisis nisi, a faucibus arcu nisi egetet ex}
\end{document}

Current result

enter image description here

3

Assuming that you do not have paragraphs in your parshape:

\def\triangledownpar#1{\vspace*{\fill}\noindent%
     \makebox[\linewidth]{%
        \Shapepar\triangledownshape#1\unskip\ .\par}\vfill}

enter image description here

  • Nice solution, very elegant! I don't have paragraphs, but what if I had? What would create problems? Just curious. – Alenanno Feb 3 '16 at 23:34
  • @Alenanno: For paragraphs you can't use \makebox. – Werner Feb 3 '16 at 23:36
  • @Werner I had the feeling it was something like that. Thanks for clarifying! – Alenanno Feb 3 '16 at 23:38
4

Box it inside a varwdith environment, which allows you to move it around:

enter image description here

\documentclass{article}
\usepackage{showframe}
\usepackage{shapepar,varwidth}

\def\triangledownshape{%
  {0}%
  {0}b{0}\\%
  {0}t{-10}{20}\\%
  %{8.66}t{-5}{10}\\%
  {17.32}e{0}%
}
\def\triangledownpar#1{\Shapepar\triangledownshape #1\unskip\ .\par}

\begin{document}

\vspace*{\fill}

\begin{center}
  \begin{varwidth}{\linewidth}
    \triangledownpar{Lorem ipsum dolor sit amet, consectetur adipiscing 
      elit. Ut porttitor magna posuere tristique interdum. Maecenas ac nisi 
      rutrum, tincidunt ante a, cursus est. Pellentesque dui ligula, maximus 
      quis viverra sit amet, cursus sed urna. Donec eu erat sed justo cursus 
      tristique non quis nisi. Suspendisse dapibus lorem nec laoreet 
      interdum. Duis sit amet leo sagittis, tincidunt elit in, imperdiet 
      diam. Nulla mi justo, tincidunt a ullamcorper eget, consequat ut odio. 
      Aliquam erat volutpat. Suspendisse potenti. Aenean tristique arcu 
      orci, sit amet dignissim ligula elementum vitae. Praesent auctor augue 
      eu lacus tempor maximus. Quisque auctor, odio eu laoreet congue, mi 
      massa facilisis nisi, a faucibus arcu nisi egetet ex}
  \end{varwidth}
\end{center}

\vfill

\end{document}
  • Thanks! :D I chose the other answer, but it's good to see alternatives when possible. – Alenanno Feb 3 '16 at 23:35

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.