1

This table should fit into one column of two column page perfectly. But it displayed a bit longer than column width. I want to make it fit correctly.

    \begin{table}[h] 
    \renewcommand{\arraystretch}{1.3} 
    \caption{example}
    \label{an example}
    \centering 
    \hrule
    \begin{align*}
     &(\lambda x.xx)\lambda m \lambda n. m n &\\
     &(xx)[x:=\underline{\lambda m \lambda n. m n}] &\textbf{Step 2}  \\
     &(\underline{\lambda m_1 \lambda n_1. m_1 n_1})(\underline{\lambda m_2    \lambda n_2. m_2 n_2}) \\
     &(\lambda n_1. m_1 n_1)[m_1:=\lambda m_2 \lambda n_2. m_2 n_2] \\
     & \lambda n_1.((m_1 n_1)[m_1:=\underline{\lambda m_2 \lambda n_2. m_2 n_2}])   &\textbf{Step 5} \\
     & \lambda n_1.((m_1[m_1:=\underline{\lambda m_3 \lambda n_3. m_3 n_3}])(n_1[m_1:=\underline{\lambda m_4 \lambda n_4. m_4 n_4}]))  \\
     & \lambda n_1.((\lambda m_3 \lambda n_3. m_3 n_3)n_1)\\
     & \lambda n_1.((\lambda n_3. m_3 n_3)[m_3:=n_1]) \\
     & \lambda n_1.(\lambda n_3. ((m_3 n_3)[m_3:=\underline{n_1}])) &\textbf{Step 9} \\
    & \lambda n_1.(\lambda n_3.((m_3[m_3:=\underline{n_1}])(n_3[m_3:=\underline{n_1}]))) \\
    & \lambda n_1.(\lambda n_3.(n_1 n_3))
    \end{align*}
    \normalsize
    \hrule
    \end{table} 

There is a image shows my problem, the width is little bit bigger than it should be. (did not show the left column completely, but I think you can see)

enter image description here

how can I do that? thanks in advance

2
  • Welcome to TeX.SE. Please tell us which document class you use.
    – Mico
    Apr 26, 2016 at 7:17
  • The way align works, every line has to have room for the "Step" column, even if they don't use it. You could use \tag{\textbf{Step 2}} for example instead. Apr 26, 2016 at 13:40

2 Answers 2

1

If you can fit the longest equation into the column, then this will work.

\documentclass[twocolumn]{article}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{table}[h] 
    \renewcommand{\arraystretch}{1.3} 
    \caption{example}
    \label{an example}
    \centering 
    \rule{\columnwidth}{.5pt}
    \begin{align*}
     &(\lambda x.xx)\lambda m \lambda n. m n &\\
     &(xx)[x:=\underline{\lambda m \lambda n. m n}] \tag{\textbf{Step 2}}  \\
     &(\underline{\lambda m_1 \lambda n_1. m_1 n_1})(\underline{\lambda m_2    \lambda n_2. m_2 n_2}) \\
     &(\lambda n_1. m_1 n_1)[m_1:=\lambda m_2 \lambda n_2. m_2 n_2] \\
     & \lambda n_1.((m_1 n_1)[m_1:=\underline{\lambda m_2 \lambda n_2. m_2 n_2}])   \tag{\textbf{Step 5}} \\
     & \lambda n_1.((m_1[m_1:=\underline{\lambda m_3 \lambda n_3. m_3 n_3}])
       (n_1[m_1:=\underline{\lambda m_4 \lambda n_4. m_4 n_4}]))  \\
     & \lambda n_1.((\lambda m_3 \lambda n_3. m_3 n_3)n_1)\\
     & \lambda n_1.((\lambda n_3. m_3 n_3)[m_3:=n_1]) \\
     & \lambda n_1.(\lambda n_3. ((m_3 n_3)[m_3:=\underline{n_1}])) \tag{\textbf{Step 9}} \\
    & \lambda n_1.(\lambda n_3.((m_3[m_3:=\underline{n_1}])(n_3[m_3:=\underline{n_1}]))) \\
    & \lambda n_1.(\lambda n_3.(n_1 n_3))
    \end{align*}
    \normalsize
    \hrule
    \end{table} 

\end{document}

demo

1

Assuming, that you use standard article class, you can fit your set of equations in one column width if you broke the longest equation into two line:

\documentclass[twocolumn]{article}
\usepackage{mathtools}
\usepackage{lipsum}

    \begin{document}
\lipsum[2]
    \begin{table}[h]
    \renewcommand{\arraystretch}{1.3}
    \caption{example}
    \label{an example}
    \centering
    \hrule
    \begin{align*}
     &(\lambda x.xx)\lambda m \lambda n. m n &\\
     &(xx)[x:=\underline{\lambda m \lambda n. m n}] 
        &   \textbf{Step 1}  \\
     &(\underline{\lambda m_1 \lambda n_1. m_1 n_1})(\underline{\lambda m_2    \lambda n_2. m_2 n_2}) \\
     &(\lambda n_1. m_1 n_1)[m_1:=\lambda m_2 \lambda n_2. m_2 n_2] \\
     & \lambda n_1.((m_1 n_1)[m_1:=\underline{\lambda m_2 \lambda n_2. m_2 n_2}])
            & \textbf{Step 5} \\
     & \begin{multlined}[0.5\linewidth]
        \lambda n_1.((m_1[m_1 :=\underline{\lambda m_3 \lambda n_3. m_3 n_3}])\\
            (n_1[m_1 :=\underline{\lambda m_4 \lambda n_4. m_4 n_4}]))  
        \end{multlined} \\
     & \lambda n_1.((\lambda m_3 \lambda n_3. m_3 n_3)n_1)\\
     & \lambda n_1.((\lambda n_3. m_3 n_3)[m_3:=n_1]) \\
     & \lambda n_1.(\lambda n_3. ((m_3 n_3)[m_3:=\underline{n_1}])) 
                &   \textbf{Step 9} \\
    & \lambda n_1.(\lambda n_3.((m_3[m_3:=\underline{n_1}])(n_3[m_3:=\underline{n_1}]))) \\
    & \lambda n_1.(\lambda n_3.(n_1 n_3))
    \end{align*}
    \normalsize
    \hrule
    \end{table}
\end{document}    

enter image description here

Edit: solution with all equations in one line and still have \footnotesize fonts. By help of tabular environment is possible to allow to the longest equation to protrude in space column with comments about steps:

\documentclass[twocolumn]{article}
\usepackage{array}
\usepackage{lipsum}

    \begin{document}
\lipsum[2]
    \begin{table}[h]
    \renewcommand{\arraystretch}{1.3}
    \footnotesize
    \caption{example}
    \label{an example}
    \centering
    \hrule
    \begin{tabular}{@{} >{$}p{0.82\linewidth}<{$} >{\bfseries}l @{}}
(\lambda x.xx)\lambda m \lambda n. m n              &           \\
(xx)[x:=\underline{\lambda m \lambda n. m n}]       &   Step 2  \\
(\underline{\lambda m_1 \lambda n_1. m_1 n_1})
(\underline{\lambda m_2\lambda n_2. m_2 n_2})       &           \\
(\lambda n_1. m_1 n_1)[m_1:=\lambda m_2 \lambda n_2. m_2 n_2]   
                                                    &           \\
\lambda n_1.((m_1 n_1)[m_1:=\underline{\lambda m_2 \lambda n_2. m_2 n_2}])
                                                    &   Step 5  \\
\multicolumn{2}{@{}l}{$
\lambda n_1.((m_1[m_1 :=\underline{\lambda m_3 \lambda n_3. m_3 n_3}])
            (n_1[m_1 :=\underline{\lambda m_4 \lambda n_4. m_4 n_4}]))
                      $}                                        \\
\lambda n_1.((\lambda m_3 \lambda n_3. m_3 n_3)n_1) &           \\
\lambda n_1.((\lambda n_3. m_3 n_3)[m_3:=n_1])      &           \\
\lambda n_1.(\lambda n_3. ((m_3 n_3)[m_3:=\underline{n_1}]))
                                                    &   Step 9  \\
\lambda n_1.(\lambda n_3.((m_3[m_3:=\underline{n_1}])
            (n_3[m_3:=\underline{n_1}])))           &           \\
\lambda n_1.(\lambda n_3.(n_1 n_3))                 &
    \end{tabular}
    \normalsize
    \hrule
    \end{table}
\end{document}  

enter image description here

1
  • Hi, I updated it with a picture. I think I don't have to break long lines because it is still shorter than column width, as shown in picture.
    – alim
    Apr 26, 2016 at 8:00

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.