Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm looking for some sort of vertical equivalent for \rlap, which can be used to typeset maybe one or more paragraphs (or minipages), but do not advance vertically the content that would appear immediately following this command. Are there anywhere some implementations of \tlap and \blap?

share|improve this question
add comment

4 Answers

up vote 13 down vote accepted

Usually I define those by hand. I don't know any package that provides them. Roughly something like:

\documentclass{article}

\newcommand{\tlap}[1]{\vbox to 0pt{\vss\hbox{#1}}}
\newcommand{\blap}[1]{\vbox to 0pt{\hbox{#1}\vss}}

\begin{document}

\hrulefill\blap{\shortstack{haha\\huhu}}\hrulefill
\tlap{\shortstack{haha\\huhu}}\hrulefill\par

\end{document}
share|improve this answer
add comment

You can use \raisebox for this:

\raisebox{-\height}[0pt][0pt]{<content>}% blap
\raisebox{0pt}[0pt][0pt]{<content>}% tlap, without changing the baseline
\raisebox{+\depth}[0pt][0pt]{<content>}% tlap, with lapping it completely upwards

As Stephane pointed out you can also use \vbox to 0pt and \vss for this. See also my post and the discussion about this on comp.text.tex:
Vertical versions of \llap and \rlap: \tlap and \blap

I would write it now as follows to avoid any issues if used at the begin or between paragraphs:

\newcommand{\tlap}[1]{\mbox{\vbox to 0pt{\vss\hbox{#1}}}}
\newcommand{\blap}[1]{\mbox{\vbox to 0pt{\hbox{#1}\vss}}}
share|improve this answer
    
but that would require me to measure the \height or \depth, no? –  Juan A. Navarro Jul 22 '11 at 18:36
    
@Juan: \raisebox does this for you. It stores the content in a register for this, so using \vbox is more efficient, but you have more freedom with \raisebox. –  Martin Scharrer Jul 22 '11 at 18:41
add comment

You can use \smash Here a small introduction: TUGboat, Volume 22 (2001), No. 4

share|improve this answer
    
Thanks, that works but seems to be something like \tlap while I was looking for \blap. –  Juan A. Navarro Jul 22 '11 at 18:36
    
This works similar like \tlap without changing the baseline, but not for \blap or for lapping it complete upwards including the depth. Good article BTW, I wanted to link to it as well. –  Martin Scharrer Jul 22 '11 at 18:41
    
Just for information, the Tugboat article referenced in the answer was published in TUGboat Volume 22, Number 4, December 2001, on page 350. –  mas Aug 5 '11 at 15:34
    
@mas: Thanks. I edited my post –  Marco Daniel Aug 6 '11 at 6:10
    
Reading the linked article leaves me wondering how come it doesn't mention \hidewidth at all. –  morbusg Aug 6 '11 at 11:31
add comment

The just-submitted stackengine package has vertical lapping commands built into it. Furthermore, while the package defaults to a +/-\baselineskip vertical shift for the lap, that dimension may be tailored for your need.

In the example, below, I place a visible marker at the invocation site, so that you can see from where the lap is in reference to.

Hopefully, CTAN will propagate the package this weekend.

\documentclass{article}
\usepackage{stackengine}
\usepackage{verbatimbox}
\parindent 0in\parskip 1em
\fboxsep=0pt\fboxrule=.1pt
\def\lapmark{\rule[-.3\baselineskip]{.1ex}{\baselineskip}}
\begin{document}
For illustration only, laps will be shown at a \textit{visible} lapmark
(given by \lapmark~), defining the point of invocation.  In these
examples, I lap a \verb|\parbox| above or below the selected location.

\begin{myverbbox}{\bll}\bllap\end{myverbbox}
\begin{myverbbox}{\brl}\brlap\end{myverbbox}
\begin{myverbbox}{\tll}\tllap\end{myverbbox}
\begin{myverbbox}{\trl}\trlap\end{myverbbox}
\begin{myverbbox}{\bcl}\bclap\end{myverbbox}
\begin{myverbbox}{\tcl}\tclap\end{myverbbox}
For example here\lapmark%
\bllap{\parbox[t]{.7in}{this is a bottom-left lap \bll}}
or el\lapmark%
\brlap{\parbox[t]{.8in}{this is a bottom-right lap \brl}}%
se here, or else I can put it here\lapmark%
\tllap{\parbox[b]{.7in}{this is a top-left lap \tll}}
or here\lapmark%
\trlap{\parbox[b]{.7in}{this is a top-right lap \trl}}%
.

Of course, I can per\lapmark
\bclap{\fbox{\parbox[t]{1.1in}{this is a bottom-center lap \bcl}}}%
form center lapping, as we\lapmark%
\tclap{\fbox{\parbox[b]{1.1in}{this is a top-center lap \tcl}}}%
ll.

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.