Graphics, Figures & TablesNice table without column

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Nice table without column

Post by cgnieder »

pallav wrote:I have made the whole table to script size.
I'm quite sure there are better ways but until you give us a Infominimal working example (!) it's impossible to tell!
pallav wrote:Would you please tell me how to increase the distance of two adjacent rows and two adjacent columns a little bit more?
There is more than one way: for example the space between columns can be adjusted using the @ specifier; and the space between rows can be changed in multiple ways, too. Which one is the best/right one in your case is hard if not impossible to say without the actual use case. So even if I begin sounding like a parrot: please provide a Infominimal working example.

Regards
site moderator & package author

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

Nice table without column

Post by pallav »

I am writing the minimal code:

Code: Select all

\documentclass[11pt]{article}
\usepackage{caption}
\usepackage{booktabs,multirow,amsmath,amssymb,array}
\usepackage{siunitx}


\begin{document}
  \begin{table}[!ht]
    \caption{Markov channel parameter settings}
    \centering
    \label{tab:markovchapara}
		\scriptsize\addtolength{\tabcolsep}{-5pt}
    \begin{tabular}{
      c
      >{$}c<{$}
      @{~}
      >{$}c<{$}
			@{~}
      >{$}c<{$}
      @{~}
      >{$}c<{$}
    }\toprule
      \multirow{2}{*}[-0.5ex]{Channel $j$} & \multicolumn{2}{p{9em}}{A long, long, long line, that is broken}  & \multicolumn{2}{p{9em}}{A long, long, long line, that is broken 2} \\ \cmidrule(r){2-3}\cmidrule(l){4-5}
        & p_j                                     & q_j & \pi_{bj}                               & \pi_{ij} \\ \midrule
      1 & - \left( 2\,\alpha\,L-L+2\,\alpha-{\alpha}^{2} \right)     & {\lambda}^{2}+\Omega_{{1}}\lambda+\Omega_{{2}}     &\frac{\beta\,y^*\alpha}{\left( x^*+\alpha \right) ^{2}}   & -{\omega}^{2}+i\Omega_{{1}}\omega+\Omega_{{2}}  \\[2ex]
      2 & \left( L\,\beta\,\frac{\left( \beta-\gamma \right)}{\delta} +\,
\alpha\, \left(2\,L-\alpha-\alpha\,L \right)\right)     & -{\omega }^{2}+a_{{10}}b_{{01}}-\cos \left( \omega \,\tau  \right) a_{{01}}b_{{10}}     & \alpha\,L\, \frac{\left( \delta\,\alpha-\gamma\,\beta \right)}{\delta}    & -{ \omega} \left( a_{{10}}+b_{{01}} \right) +\sin \left( \omega \,\tau  \right) a_{{01}}b_{{10}}  \\
    \bottomrule
    \end{tabular}
  \end{table}
\end{document}
I want to get my code little bit compact and I need the distance of rows and columns (especially between 2rd & 3rd column) more.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Nice table without column

Post by cgnieder »

Here is an idea using tabu. Maybe this get's you further.

Code: Select all

\documentclass[11pt]{article}
\usepackage{caption}
\usepackage{booktabs,multirow,amsmath,amssymb,array}
\usepackage{siunitx}
\usepackage{tabu}

\begin{document}

\begin{table}[!ht]
  \caption{Markov channel parameter settings}
  \label{tab:markovchapara}
  \small\tabulinesep=1mm
  \begin{tabu} to \linewidth {X[1.5c]X[$2C]X[$2C]X[$2C]X[$2C]}
   \toprule
    \multirow{2}{*}[0.5ex]{Channel $j$} &
    \multicolumn{2}{p{\dimexpr 7\linewidth/19\linewidth-5\tabcolsep}}{A long, long, long, long, long line, that is broken} &
    \multicolumn{2}{p{\dimexpr 7\linewidth/19\linewidth-5\tabcolsep}}{A long, long, long, long, long line, that is broken} \\
   \cmidrule(r){2-3}\cmidrule(r){4-5}
     & p_j & q_j & \pi_{bj}   & \pi_{ij} \\
   \midrule
    1 & - \Bigl( 2\,\alpha\,L - L + 2\,\alpha -\alpha^{2} \Bigr)
      & \lambda^{2}+\Omega_{1}\lambda + \Omega_{2}
      & \frac{\beta\,y^*\alpha}{( x^* + \alpha )^{2}}
      & -{\omega}^{2}+i\Omega_{{1}}\omega+\Omega_{{2}}  \\
    2 & \Bigl( L\,\beta\,\frac{\beta-\gamma}{\delta} + \alpha \bigl(2\,L-\alpha-\alpha\,L \bigr)\Bigr)
      & -\omega^{2} + a_{10}b_{01} - \cos(\omega\,\tau) a_{01}b_{10}
      & \alpha\,L\, \frac{\delta\,\alpha - \gamma\,\beta}{\delta}
      & -\omega ( a_{10} + b_{01} ) +\sin(\omega\,\tau) a_{01}b_{10}  \\
   \bottomrule
   \tabuphantomline
  \end{tabu}
\end{table}

\end{document}
Regards
site moderator & package author
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

Re: Nice table without column

Post by pallav »

Thanks for the code. I have installed the tabu, but I am getting 100 errors. I have attached here the log file.
Attachments
LaTeX112.log
(56.33 KiB) Downloaded 275 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Nice table without column

Post by cgnieder »

Have you used the exact same code? If not please do so see if the code works for you.

If yes I am not sure what is going wrong. I can at least see that you have outdated versions of l3kernel, l3packages and siunitx. Try to leave the latter out of the example as it is not needed here anyway.

The important error is the first one:
! Package calc Error: `\linewidth ' invalid at this point.

See the calc package documentation for explanation.
Type H <return> for immediate help.
...

l.31 \end{tabu}
IIRC the older l3kernel used the calc so this might be the cause, but ...
site moderator & package author
Post Reply