2

Here is the table:

\documentclass{article}
\usepackage{multirow,rotating}
\begin{document}

\begin{sidewaystable}[]
    \caption{Comparison of various models}
    \label{tab:gr}
  \bigskip
    \centering\small\setlength\tabcolsep{2pt}
        \hspace*{-1cm}\begin{tabular}{| l  | c | c | c | c | c | c | }
           \toprule
             \textbf{Type} & \textbf{Bandwidth} & \textbf{$Q$ value} & \textbf{Source Resistance ($R_i$)} & \textbf{Load Resistance ($R_L$)} & \textbf{Power Efficiency}  \\
           \midrule
             \textit{SS} & Low, at around \SI{10}{\kilo\hertz} & High, around 200. $Q$ for $f_-$ increases with increase in k, where as $Q$ for $f_-$ decreases with increase in k & High $R_i$ offers single peak resonance frequency component. Normally fixed at \SI{5.1}{\ohm} & Optimal at \SI{65}{\ohm} & offers high efficinecy compared to other three types of circuit models  \\
             \hline
             \textit{SS1} & \blindtext & \blindtext  & \blindtext & \blindtext & \blindtext\\
             \hline
             \textit{SS2} & 7.47 &1 & 1& 1&1\\
             \hline
             \textit{SS3} & 6.79 &1 & 1&1 &1\\

           \bottomrule
        \end{tabular}\hspace*{-1cm}
\end{sidewaystable}

\end{document}

I have to add a long text into each cell of 2nd , 3rd ,4th and 5th columns.

I do not know how much text I will be adding. So I just want the latex to intelligently wrap the text inside each cell and make the complete table to wrap inside a page margin. Of course I wont be adding a page length text inside each cell, it will be a two full length lines for an example.

So can this be done?

  • 2
    the same as all tabular based environments use p{3cm} for a fixed width column instead of c (which is always a single line entry) – David Carlisle Nov 21 '16 at 14:28
  • @DavidCarlisle...that worked thanks. May I know how to make the text in a cell to start from the center instead of from start of the cell ? – gocjack Nov 21 '16 at 15:03
  • 1
    \centering or for the whole column >{\centering\arraybackslash}p{3cm} (array package) – David Carlisle Nov 21 '16 at 15:33
2

To extend @DavidCarlisle's comment:

  • it is easiest to use a new column type for this
  • you should not use vertical lines as you use booktabs (I have left them in there to see the problem)
  • MWE's should always be compilable, I had to add some packages

table

\documentclass{article}
\usepackage{multirow,rotating,array,booktabs,siunitx,blindtext}
\newcolumntype{C}{>{\centering\arraybackslash}p}

\begin{document}

\begin{sidewaystable}[]
    \caption{Comparison of various models}
    \label{tab:gr}
  \bigskip
    \centering\small\setlength\tabcolsep{2pt}
        \hspace*{-1cm}\begin{tabular}{| l  | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | C{.13\textwidth} | }
           \toprule
             \textbf{Type} & \textbf{Bandwidth} & \textbf{$Q$ value} & \textbf{Source Resistance ($R_i$)} & \textbf{Load Resistance ($R_L$)} & \textbf{Power Efficiency}  \\
           \midrule
             \textit{SS} & Low, at around \SI{10}{\kilo\hertz} & High, around 200. $Q$ for $f_-$ increases with increase in k, where as $Q$ for $f_-$ decreases with increase in k & High $R_i$ offers single peak resonance frequency component. Normally fixed at \SI{5.1}{\ohm} & Optimal at \SI{65}{\ohm} & offers high efficinecy compared to other three types of circuit models  \\
             %\hline
             %\textit{SS1} & \blindtext & \blindtext  & \blindtext & \blindtext & \blindtext\\
             \hline
             \textit{SS2} & 7.47 &1 & 1& 1&1\\
             \hline
             \textit{SS3} & 6.79 &1 & 1&1 &1\\

           \bottomrule
        \end{tabular}\hspace*{-1cm}
\end{sidewaystable}

\end{document}

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.