1

Suppose I have two \PsTextFrames that share y-coordinates, but have different x-coordinates, like the following:

\documentclass{article}
\usepackage{fontspec}
\usepackage{pst-all}

\begin{document}

\begin{pspicture}(0,0)(5,2) \psset{linewidth=1pt} \psTextFrame(0.5,0.5)(2.5,1.5){\large\textbf{Left}} \psTextFrame(1.5,0.5)(3.5,1.5){\large\textbf{Right}}
\end{pspicture} \end{document}

Is there a possibility to have their letters be aligned horizontally? The letter »g« in »Right« makes the whole word rise, because it has a »cellar«. In »Left« there is no letter with »cellar«. A single instance like this may be done manually, but I have a larger picture where a lot more frames hang together. Changing them all at once would be feasible.

enter image description here

Kubo
  • 368

1 Answers1

1

As a workaround you can patch the \psTextFrame command to include vertical phantom characters, to ensure that each frame has the same height. A vertical phantom character is a character with zero width (so it is not printed or added in any way to the pdf) but that is still allocated the height of the character, so LaTeX will make the box bigger vertically.

MWE:

\documentclass{article}
\usepackage{pst-all}
\usepackage{etoolbox}

\makeatletter \patchcmd{\psTextFrame@i}{#3}{\vphantom{Xq}#3}{}{} \makeatother

\begin{document} \begin{pspicture}(0,0)(5,2) \psset{linewidth=1pt} \psTextFrame(0.5,0.5)(2.5,1.5){\large\textbf{Left}} \psTextFrame(1.5,0.5)(3.5,1.5){\large\textbf{Right}}
\end{pspicture} \end{document}

Result:

enter image description here

Marijn
  • 37,699
  • That’s great. Never heard about virtual phantom characters. Where can I read more about them? – Kubo Dec 09 '20 at 12:22
  • 1
    @Kubo You can read for example "TeX for the Impatient" (http://texdoc.net/texmf-dist/doc/plain/impatient/book.pdf) on page 167 (printed page number, that is page 187 in the pdf file), section Struts, phantoms, and empty boxes. You can also read it offline in a terminal using texdoc impatient/book.pdf. This book is also available in French and Chinese (for free) from TeXdoc online and offline. – Marijn Dec 09 '20 at 15:21
  • 1
    There are more books available, see https://tex.stackexchange.com/questions/27636/which-books-can-i-read-via-texdoc. – Marijn Dec 09 '20 at 15:22