1

I have a wide table in a document. So I am using landscape to cover the table. The table has been created using tabu. I am getting the following result:enter image description here

with the input attached at the end of the question. I am trying to obtain a table where the table is spread over the whole width. I am using X column of tabu which works great in portrait mode. How can I make it in landscape mode to look my table nicer?

\documentclass[12pt]{article}


\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{physics}
\usepackage{tabu}

\begin{document}

Some content

\afterpage{%
    \clearpage% Flush earlier floats (otherwise order might not be correct)
    \thispagestyle{empty}% empty page style (?)
    \begin{landscape}% Landscape page
        \centering % Center table
\begin{tabu} to \textwidth {X[m,c]X[m,c]X[m,c]X[m,c]X[m,c]X[m,c]}
 & Magnitude (in terms of quantum  number $l, s,$ or $j$) & Possible values  it can get for one orientation  $(m_{l}, m_s,$ or $m_j$) & Magnetic moment (vector) & Magnetic moment (magnitude) & g-factor \\ 
 
Orbital Angular Momentum $(\vb{L})$   &  $|\vb{L}|=\sqrt{l(l+1)}\hbar$  &  $-l, -l+1, \ldots, l$   &  $\mu_{\vb{l}}=-g_o\frac{e}{2m_e}\vb{l}$   &   $g_o\mu_B\sqrt{l(l+1)}$     &    1     \\ 

Spin Angular Momentum $(\vb{S})$  & $|\vb{S}|=\sqrt{s(s+1)}\hbar$    &   $-s, -s+1, \ldots, s$    &  $\mu_{\vb{s}}=-g_s\frac{e}{2m_e}\vb{s}$      & $g_s\mu_B\sqrt{s(s+1)}$  &     2    \\ 

Total Angular Momentum $(\vb{J}=\vb{L}+\vb{S})$ & $|\vb{J}|=\sqrt{j(j+1)}\hbar$ &  $-j, -j+1, \ldots, j$ & $\mu_{\vb{s}}=-g\frac{e}{2m_e}\vb{j}$    & $g\mu_B\sqrt{j(j+1)}$    &     \\ 
\end{tabu}
    \end{landscape}
    \clearpage% Flush page
}
\end{document}

Edit: Following DavidCarisle's comment and changing

\textwidth{X[m,c]X[m,c]X[m,c]X[m,c]X[m,c]X[m,c]}

to

\linewidth{X[3c]X[3m,c]X[3m,c]X[3m,c]X[2m,c]X[2m,c]}

gives a better look. But I am still looking for a solution, if possible, to widen the table over full landscape width. enter image description here

4
  • 3
    tabu does not really work with current latex (and is not maintained) but you could use \linewidth in place of \textwidth Oct 29, 2023 at 22:58
  • @DavidCarlisle it makes the table a little better but not to the extent I was looking for. I played with the parameters and it gives much better result (see the edited question). However, I don't understand how to spread the table over full width. Oct 29, 2023 at 23:44
  • 1
    {tabu} to 25cm or whatever size you want Oct 30, 2023 at 0:14
  • 1
    tabu was dis-recommended, though I don't know if that's still the case. There are better packages.
    – cfr
    Oct 30, 2023 at 0:54

1 Answer 1

1

You should be aware that in landscape orientation the width of the text block is equal to \textheight. If you determine width of table by \linewidth, it will for width of table use \textheight.

As already mentioned in comments, don9t use tabu package, rather use tabularx or even better tabularray which among others consider many features of tabu.

Possible MWE, using tblr of tabularray package and a wee bit redesign of table, can be:

\documentclass[12pt]{article}

\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{physics}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}

Some content

\afterpage{%
    \clearpage% Flush earlier floats (otherwise order might not be correct)
    \thispagestyle{empty}% empty page style (?)
    \begin{landscape}% Landscape page 
\mbox{}\vfil    % for move table to vertical center of landscape oriented page
\begin{tblr}{colsep  = 4pt,
             colspec = {@{} X[l,m] 
                            X[0.9, c, m,  mode=math]
                            X[1.2, c, m,  mode=math] 
                       *{2}{X[0.9, c, m, mode=math]}
                            Q[c] @{}},
             row{1}  = {font=\small, mode=text, f}
              }
    \toprule
    & Magnitude (in terms of quantum  number $l, s,$ or $j$) 
        & Possible values  it can get for one orientation  $(m_{l}, m_s,$ or $m_j$) 
            & Magnetic moment (vector) 
                & Magnetic moment (magnitude) 
                    & {g\\ factor} \\
    \midrule
Orbital Angular Momentum $(\vb{L})$   
    & \abs{\vb{L}}=\sqrt{l(l+1)}\hbar  
        & -l, -l+1, \ldots, l   
            & \mu_{\vb{l}}=-g_o\frac{e}{2m_e}\vb{l}    
                & g_o\mu_B\sqrt{l(l+1)}     
                    &    1     \\
Spin Angular Momentum $(\vb{S})$  
    &  \abs{\vb{S}}=\sqrt{s(s+1)}\hbar    
        & -s, -s+1, \ldots, s   
            &  \mu_{\vb{s}}=-g_s\frac{e}{2m_e}\vb{s}      
                & g_s\mu_B\sqrt{s(s+1)}   
                    &     2    \\
Total Angular Momentum $(\vb{J}=\vb{L}+\vb{S})$ 
    & \abs{\vb{J}}=\sqrt{j(j+1)}\hbar 
        & -j, -j+1, \ldots, j 
            & \mu_{\vb{s}}=-g\frac{e}{2m_e}\vb{j}     
                & g\mu_B\sqrt{j(j+1)}     
                    &     \\
    \bottomrule
\end{tblr}
    \end{landscape}
    \clearpage% Flush page
}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .