2

How can I vertically center the text between the two ornaments? When I put the three lines in an \fbox it looks almost centered but not completely.

MWE:

\documentclass{article}
\usepackage{pgfornament}
\begin{document}
\begin{center}
\pgfornament[width=4cm]{88}\\
$\mathcal{SP}$\\
\pgfornament[width=4cm]{88}
\end{center}
\end{document}
1
  • adding a \vspace{2mm} visually does the job if you(re in a hurry. Would like to see a clean solution too.
    – Denis
    Mar 1, 2019 at 16:18

2 Answers 2

3

A simple \raisebox will do:

\documentclass{article}
\usepackage{pgfornament}
\usepackage{array, makecell}
\usepackage[usestackEOL]{ stackengine}

\begin{document}

\begin{center}
\pgfornament[width=4cm]{88}\\
\raisebox{-0.5\height}{$\mathcal{SP}$}\\
\pgfornament[width=4cm]{88}
\end{center}

\end{document} 

enter image description here

2
  • Can you explain the number 0.5, is it 50%? And what does \height stand for?
    – Tommiie
    Mar 1, 2019 at 23:42
  • 1
    \height is the box height. And yes I lowere the box by an amount of 50% its height, so that the base line passes through the vertical centre of the box.
    – Bernard
    Mar 1, 2019 at 23:50
0

I should learn to read the documentation provided with the package. The examples at the back hint towards this solution:

\begin{tikzpicture}
   \node at (0,1) {\pgfornament[width=4cm,anchor=north]{88}};
   \node at (0,.5) {$\mathcal{SP}$};
   \node at (0,0) {\pgfornament[width=4cm,anchor=north]{88}};
\end{tikzpicture}

You must log in to answer this question.

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