Graphics, Figures & TablesRotate a table and should not move it to next page (PDF screen shot attached)

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Matam
Posts: 29
Joined: Thu Jun 07, 2018 12:12 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Matam »

Please see the attachment and give me a solution to rotate the table and not move it to next page.
Attachments
Appendix_screenshot.png
Appendix_screenshot.png (273.57 KiB) Viewed 11415 times

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Stefan Kottwitz »

You could use this:

Code: Select all

\usepackage{rotating}
\begin{document}
...
\begin{sidewaystable}
  \centering
  \caption{Your table caption}
  \begin{tabular}{...}
    ...
  \end{tabular}
\end{sidewaystable}
Stefan
LaTeX.org admin
Matam
Posts: 29
Joined: Thu Jun 07, 2018 12:12 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Matam »

I did add the code as you told. The good part is that table is rotated. BUt, it still appeared in second page by keeping the first page blank. Please, check the attached PDF screen shot.
Attachments
rotateerror.png
rotateerror.png (135.17 KiB) Viewed 11394 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Stefan Kottwitz »

Or rotate this way:

Code: Select all

\usepackage[graphicx]{realboxes}
\usepackage{varwidth}
...
\begin{document}
...
\begin{table}[!htbp]
\centering
 \rotatebox{90}{%
   \begin{varwidth}{\textheight}
      \caption{the caption text}\label{tab:1}
      \begin{tabular}{...}
        ...
      \end{tabular}
    \end{varwidth}}
\end{table}
\end{document}[/code]

Stefan
LaTeX.org admin
Matam
Posts: 29
Joined: Thu Jun 07, 2018 12:12 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Matam »

Sorry. It did not work at all.

I added those two packages mentioned by you and Here is the code I entered:
\begin{table}[!htbp]
\centering
 \rotatebox{90}{%
   \begin{varwidth}{\textheight}
\caption{Switch comparison}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{Particulars} & \multicolumn{5}{c|}{per unit}  \\ \cline{2-6} 
 & IGBT\cite{igbt}& \gls{spst} \cite{spstdpst} & \gls{spdt} \cite{digikey} & \gls{dpst}\cite{spstdpst} & \gls{dpdt}\cite{dpdt} \\ \hline 
Size(in mm)&20x16x5&10x7x5&18x14 $\times$ 15&20x10x11&29x25x13 \\ \hline
AC Rating & 1200V, 5A & 250V,5A & 250V,5A & 250V,5A&250V,5A \\ \hline
\begin{tabular}[c]{@{}c@{}}Conduction loss \\ P$_{con}$ (in W)\end{tabular} & \begin{tabular}[c]{@{}c@{}}13.5$^{**}$\end{tabular} & 2.5&2.5&2.5&2.5 \\ \hline
\begin{tabular}[c]{@{}c@{}}Gate loss \\ P$_{gate}$ (in W)\end{tabular} & \begin{tabular}[c]{@{}c@{}}DNA\end{tabular} & 0.75&0.4&0.75&0.54 \\ \hline
%\begin{tabular}[c]{@{}c@{}}Perday loss(Whr)$^*$\end{tabular} & 130.5&25& 13.4                                                      \\ \hline
%\begin{tabular}[c]{@{}c@{}}Switching time($T_{on}$+$T_{off}$)\end{tabular}& 1.8+2.0= 3.8$\mu$s   &3.3ms     & 6+4=10ms    \\ \hline
\begin{tabular}[c]{@{}c@{}}Switching time\end{tabular}& 3.8$\mu$s &3.3ms& 10ms   &5ms&15ms \\ \hline
Elect. cycles &-&3x10$^4$& 10$^5$& 3x10$^4$& 10$^5$    \\ \hline
Mech. cycles & -& 10$^7$ & 5x10$^6$& 10$^7$& 10$^7$  \\ \hline
Operating temp. & $+150^{\circ}$C &\begin{tabular}[c]{@{}c@{}} -40 - +$85^{\circ}$C \end{tabular} &\begin{tabular}[c]{@{}c@{}} -40 - +$70^{\circ}$C \end{tabular} &\begin{tabular}[c]{@{}c@{}} -40 - +$85^{\circ}$C \end{tabular}                                            &\begin{tabular}[c]{@{}c@{}} -30 - +$70^{\circ}$C \end{tabular}                                             \\ \hline
\begin{tabular}[c]{@{}c@{}}market cost (in \$) \end{tabular} & 30.38 &3.59  & 2.05 &3.59&3.77\\ \hline
\end{tabular}
%}
\\
~~**~$I_{CE}$=5A,$V_{CE}$=2.7V;DNA Data not available; 
%\end{sidewaystable}
\end{varwidth}}
\end{table}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Stefan Kottwitz »

You could use a minipage instead of varwidth. Choose the height as option, as it fits. I used 0.9\textheight.

Code: Select all

text
\begin{table}[!htbp]
\centering
 \rotatebox{90}{%
   \begin{minipage}{0.9\textheight}
\caption{Switch comparison}
\begin{tabular}{|c|c|c|c|c|c|}
...
\end{tabular}
\end{minipage}}
\end{table}
text
Stefan
LaTeX.org admin
Matam
Posts: 29
Joined: Thu Jun 07, 2018 12:12 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Matam »

Excellent. Thanks a ton Stefan. It worked for me. Please, find the screen shot.
Attachments
tableDONE.png
tableDONE.png (85.78 KiB) Viewed 11351 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Rotate a table and should not move it to next page (PDF screen shot attached)

Post by Stefan Kottwitz »

The varwidth environment was for auto-adjusting the width (here: hight, as it's rotated), somehow it did not work with the content here. But as it works with minipage, fine. :-)

Stefan
LaTeX.org admin
Post Reply