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'd appreciate help top aligning the contents of \parboxes containing texts of different sizes as shown in the following graphic. Because one of the texts has a different size it appears to hover above the other: enter image description here

Source (MWE):

\documentclass[english]{article}
\begin{document}

\mbox{\Huge \textsc{Text}}
\hfill
\parbox[t]{4.25cm}{
I am a fish

I am a fish

I am a fish

I am a fish
}

\end{document}
share|improve this question
    
You can also use a tabular environment. –  Marco Daniel Jun 2 '12 at 18:46

1 Answer 1

up vote 11 down vote accepted

Sometimes you need to adjust by hand with \raisebox etc but an automated solution to align at the top of the box rather than the first baseline produces:

enter image description here

\documentclass[english]{article}
\begin{document}

\parbox[t]{3cm}{\hrule height 0pt width 0pt
\Huge \textsc{Text}
}
\hfill
\parbox[t]{4.25cm}{\hrule height 0pt width 0pt
I am a fish

I am a fish

I am a fish

I am a fish
}

\end{document}

As noted in the comments, by placing rules in the first line the \parbox[t] code aligns on the rule (so effectively at the top of the first real line rather than its baseline).

share|improve this answer
    
\vspace{0pt} is the shorter version ... –  Herbert Jun 2 '12 at 18:56
2  
@Herbert true, although I tend to use rules myself, partly I think as you can fiddle with visible rules to get special effects and then finally make them 0width (but odd height or depth) –  David Carlisle Jun 2 '12 at 19:02

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.