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.

The following latex code prints rows one at a time. However all the cells of the rows don't come out aligned. How can I fix it.

\documentclass{beamer}    
\usepackage{tabularx}  

\begin{document}

\begin{frame}{}
 \begin{tabularx}{3.50in}{lXX}
          \hline
          & Observation & Conclusion \\
          \hline  
          \uncover<2->{1.} & \uncover<2->{Observation 1 } & \uncover<2->{Conclusion 1} \\  
\uncover<3->{2.} & \uncover<3->{Observation 2} & \uncover<3->{Conclusion 2} \\  
        \end{tabularx}     
\end{frame}  
\end{document}

The output looks as follows :

enter image description here

As we can see cells in first column do not align with the rest of the rows. Will appreciate any input as to how to fix this.

share|improve this question
    
Hi Sandeep- I removed the align tag as it's reserved for questions related to the environment provided by the amsmath package; I also removed the thanks and your signature, as it's always done automatically :) –  cmhughes May 9 '12 at 20:36
    
This isn't really a fix, but if you use \begin{tabularx}{3.50in}{XXX} then the problem goes away... I don't know why this 'fixes' it though... –  cmhughes May 9 '12 at 20:40
    
@cmhughes : Thanks for the prompt reply. Removing align is fine. I see that replacing l with X fixes the alignment. However now the width of the column becomes too big. Is there anyway to set the width of a column to some fixed value? –  Sandeep May 9 '12 at 20:51
    
you could use \begin{tabularx}{3.50in}{p{1cm}XX} and change the 1cm to anything you like... –  cmhughes May 9 '12 at 21:07
add comment

1 Answer

up vote 5 down vote accepted

TeX is in a funny state at the start of table cells, it's best to avoid doing anything too clever there and beamer gradual reveals come in that category:-) \leavevmode gets you to a safer place.

enter image description here

\documentclass{beamer}    
\usepackage{times}    
\usepackage{amsmath,amsthm, amssymb, latexsym}   
\usepackage{exscale}  
\usepackage{booktabs, array}  
\usepackage{graphicx}  
\usepackage{setspace}   
\usepackage{tabularx}  
\usepackage{listliketab}  

\begin{document}

\begin{frame}{}
  \begin{listliketab}   
    \storestyleof{itemize}   
    \tiny  

        \begin{tabularx}{3.50in}{lXX}
          \hline
          & Observation & Conclusion \\
          \hline  
\leavevmode\uncover<2->{1.} & \leavevmode\uncover<2->{Observation 1 } & \leavevmode\uncover<2->{Conclusion 1} \\  
\leavevmode\uncover<3->{2.} & \leavevmode\uncover<3->{Observation 2} & \leavevmode\uncover<3->{Conclusion 2} \\  
        \end{tabularx}     
    \end{listliketab}  

\end{frame}  
\end{document}

For the first l column you're not leaving a mode at all (\relax would have done as well) you are just forcing TeX to stop looking for \multicolumn etc. In the X columns you need to stop the look-ahead for spanning columns but in addition you need to start the paragraph so the specials and any other nodes that beamer's magic drops at that position go at the start of the first line of the paragraph and not before the paragraph. You see the same with \color (which is why \textcolor starts with \leavevmode as does \mbox and most other latex commands of this sort.

share|improve this answer
    
+1 fantastic! Could you describe which modes we're leaving and entering? –  cmhughes May 9 '12 at 21:20
    
@cmhughes, answer updated –  David Carlisle May 9 '12 at 21:27
    
Thank you David. This works perfect :). –  Sandeep May 16 '12 at 0:02
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.