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 using a certain symbol that I would like to shift down without effecting it's layout(change the surrounding markup's positions):

a test case is:

$\begin{array}{ccc}
   a & b & c\\
   a & b & e\\
\end{array}$

and I want to move c down just right on top of e so the bottom of c touches, or even overlap, the top of e without effecting the layout at all(except for c). The two matrices should look identical except for how c changes.

(the answer should be relatively generic since the above is just a test case)

share|improve this question
add comment

2 Answers 2

up vote 7 down vote accepted

You can use \smash and \raisebox:

enter image description here

Notes:

  • The \hlines were added so as to be able to compare the before and after.
  • The \raisebox is used to lower the desired character, and the \smash is used to ensure that the remainder of the environment is not affected by it.

Code:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{array}{ccc}\hline
   a & b & c\\
   a & b & e\\\hline
\end{array}$
$\begin{array}{ccc}\hline
   a & b & \smash{\raisebox{-1.75ex}{c}}\\
   a & b & e\\\hline
\end{array}$
\end{document}
share|improve this answer
add comment

A nested array puts a c over e. This avoids that c and e are on different lines in the outer array and the positioning becomes independent from the contents of the other cells that might increase the distances of the rows. The inner array needs b to put the e on the baseline, see Peter Grill's comment.

Another trick is using \arraystretch with meaning 0. Then the struts are reset with nullified heights and depths that are inserted by environment array.

As requested in the question, \smash nullifies the height (and depth) of c.

\documentclass{article}
\begin{document}
$\begin{array}{ccc}
   a & b & \\
   a & b &
  \renewcommand*{\arraystretch}{0}%
  \begin{array}[b]{@{}c@{}}\smash{c}\\e\end{array}\\
\end{array}$
\end{document}

Result

share|improve this answer
1  
The bottom of the e is not quite at the baseline. Using \begin{array}[b] for the inner array appears to fix it. –  Peter Grill Nov 15 '12 at 7:41
    
@PeterGrill Thanks, fixed. –  Heiko Oberdiek Nov 15 '12 at 7:52
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.