2

I would like to adjust the relative vertical alignment (baseline) of stretches of text; I'm aware of \lower, \raise and \raisebox, but as far as I can see those commands require / represent boxes and, as such, inhibit line breaking and hyphenation. Is it possible to shift the baseline (like it is possible to change e.g. font color by issuing a color... command) for the entire text that remains within a group, without using a box?

If that should not be possible, what kind of solutions are there that do not affect line breaking?

  • luatex a possibility? – David Carlisle Dec 9 '15 at 21:17
  • I'M trying to remain compatible with xelatex and luatex... so I guess it's an option. – flow Dec 9 '15 at 21:38
  • You might be able to overlap two paragraphs with different baselines and use \color{white} and \color{black} to turn off portions of text. That would only inhibit page breaking. – John Kormylo Dec 9 '15 at 22:04
4

This uses a pdftex \pdfliteral but you could use a special for xetex

enter image description here

Here I've used two minipages side by side so that you can tell by the end that the baselines have returned to normal. On the left the region between the !! is raised by 2bp

\documentclass{article}
\begin{document}

\centering
\begin{minipage}[t]{.43\linewidth}
One two three four one two three four.
One two three four one two three four.
One two three four one two three four.
\pdfliteral{ 1 0  0 1 0 2 cm}%
!!One two three four one two three four.
One two three!!\pdfliteral{ 1 0  0 1 0 -2 cm} four one two three four.
One two three four one two three four.
One two three four one two three four.
One two three four one two three four.
\end{minipage}
\begin{minipage}[t]{.43\linewidth}
One two three four one two three four.
One two three four one two three four.
One two three four one two three four.
!!One two three four one two three four.
One two three!! four one two three four.
One two three four one two three four.
One two three four one two three four.
One two three four one two three four.
\end{minipage}

\end{document}
  • Thanks a lot! Just to clarify, I found that {\pdfliteral{ 1 0 0 1 0 -2 cm} for luatex is equivalent to \special{pdf:literal 1 0 0 1 0 -2 cm} for xelatex. Now I'll google to find out what the numbers mean; especially puzzling is the cm which certainly can't mean 'centimeters', no? – flow Dec 9 '15 at 23:29
  • @flow coordinate matrix 10 01 is a 2x2 identitiy matrix 9could scale/rotate there and 0 -2 is a translatiion uowards – David Carlisle Dec 10 '15 at 1:16

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.