7

I am trying to rotate two tables using sidewaystable but one of them was rotated clockwise while the other was rotated counterclockwise. Both of them use the same code, only the cell values are different. How do I fix this?

This is the code for both tables:

\begin{sidewaystable}[!htbp]
\centering
\begin{tabular}{l|l|l|l|l|l|l|l|l|l|l|l|l}
      & \multicolumn{4}{|c|}{FFF-W}             & \multicolumn{4}{|c|}{FFF-A}                     & \multicolumn{4}{|c}{FFF-R}                     \\ \hline
Inst. & Obj. & Desp. (\%) & $\sigma$      & Tempo & Obj. & Desp. (\%) & $\sigma$      & Tempo & Obj. & Desp. (\%) & $\sigma$      & Tempo \\ \hline
A1    & 1578     & 2.86       & 0             & 0.05  & 1578     & 2.86       & 0             & 0.05  & 1578     & 2.86       & 0             & 0.05  \\
A2    & 27990    & 13.13      & 0             & 0.05  & 27916    & 12.89      & 0             & 0.05  & 41613    & 42.23      & 5.3           & 0.05  \\
A3    & 17933    & 27.29      & 0             & 0.05  & 17788    & 26.48      & 0             & 0.05  & 21759    & 39.5       & 5.25          & 0.05  \\
A4    & 17933    & 27.29      & 0             & 0.05  & 17788    & 26.48      & 0             & 0.05  & 22342    & 38.21      & 4.94          & 0.05  \\
A5    & 25648    & 26.75      & 0             & 0.05  & 23158    & 23.06      & 0             & 0.05  & 28616    & 36.86      & 3.1           & 0.05  \\
A6    & 19684    & 25.87      & 0             & 0.05  & 19684    & 25.87      & 0             & 0.05  & 23381    & 38.61      & 5.02          & 0.05  \\
A7    & 32034    & 28.24      & 0             & 0.05  & 32145    & 28.55      & 0             & 0.05  & 38003    & 38.09      & 3.67          & 0.05  \\
A8    & 61964    & 28.73      & 0             & 0.05  & 59812    & 28.01      & 0             & 0.05  & 68575    & 35.86      & 2.05          & 0.05  \\
A9    & 23465    & 39.52      & 0             & 0.05  & 23465    & 39.52      & 0             & 0.05  & 26058    & 41.4       & 3.04          & 0.05  \\
A10   & 29015    & 22.88      & 0             & 0.05  & 32783    & 29.54      & 0             & 0.05  & 38556    & 39.96      & 3.41          & 0.05  \\
A11   & 26379    & 21.01      & 0             & 0.05  & 28519    & 28.14      & 0             & 0.05  & 33075    & 36.38      & 4.18          & 0.05  \\
A12   & 15015    & 32.91      & 0             & 0.05  & 16342    & 40.29      & 0             & 0.05  & 19038    & 43.49      & 5.72          & 0.05  \\
A13   & 80070    & 16.18      & 0             & 0.05  & 80070    & 16.18      & 0             & 0.05  & 97801    & 30.52      & 1.79          & 0.05  \\
A14   & 87501    & 18.87      & 0             & 0.05  & 86893    & 18.2       & 0             & 0.05  & 107166   & 33.47      & 1.77          & 0.05  \\
A15   & 94424    & 20.92      & 0             & 0.05  & 95616    & 22.16      & 0             & 0.05  & 111726   & 32.44      & 1.75          & 0.05  \\
A16   & 15980    & 24.18      & 0             & 0.05  & 16817    & 28.83      & 0             & 0.05  & 20500    & 36.64      & 4.53          & 0.05  \\
A17   & 11357    & 43.7       & 0             & 0.05  & 13535    & 41.23      & 0             & 0.05  & 12772    & 42.59      & 1.23          & 0.05  \\
A18   & 26261    & 24.94      & 0             & 0.05  & 26261    & 24.94      & 0             & 0.05  & 34106    & 40.85      & 3.82          & 0.05  \\
A19   & 19636    & 28.54      & 0             & 0.05  & 19636    & 28.54      & 0             & 0.05  & 23245    & 40.33      & 4.11          & 0.05  \\
A20   & 9963     & 44.84      & 0             & 0.05  & 9963     & 44.84      & 0             & 0.05  & 10256    & 44.11      & 10.37         & 0.05  \\ \hline
Média      &          & 25.9325    &               & 0.05  &          & 26.8305    &               & 0.05  &          & 36.72      &               & 0.05 
\end{tabular}
\label{tab:1}
\caption{Teste}
\end{sidewaystable}

\begin{sidewaystable}[!htbp]
\centering
\begin{tabular}{l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l}
      & \multicolumn{5}{|c|}{SHP-W}             & \multicolumn{5}{|c|}{SHP-A}                     & \multicolumn{5}{|c}{SHP-R}                     \\ \hline
Inst. & H1   & Obj. & Desp. (\%) & $\sigma$ & Tempo & H1   & Obj. & Desp. (\%) & $\sigma$ & Tempo & H1   & Obj. & Desp. (\%) & $\sigma$ & Tempo \\ \hline
A1  & 1600 & 1578     & 2.86       & 0             & 0.05  & 1600 & 1578     & 2.86       & 0             & 0.05  & 1600 & 1578     & 2.86       & 0             & 0.05  \\
A2  & 3600 & 36838    & 30.45      & 0             & 0.05  & 3500 & 36345    & 29.27      & 0             & 0.05  & 3500 & 46208    & 45.21      & 5.73          & 0.05  \\
A3  & 2300 & 21031    & 33.38      & 0             & 0.05  & 2300 & 21149    & 33.87      & 0             & 0.05  & 2300 & 22542    & 38.58      & 3.4           & 0.05  \\
A4  & 2300 & 21031    & 33.38      & 0             & 0.05  & 2300 & 21149    & 33.87      & 0             & 0.05  & 2300 & 22568    & 39.23      & 2.82          & 0.05  \\
A5  & 2400 & 27646    & 33.41      & 0             & 0.05  & 2300 & 28080    & 34.86      & 0             & 0.05  & 2400 & 30559    & 39.05      & 2.55          & 0.05  \\
A6  & 2200 & 17877    & 24.46      & 0             & 0.05  & 2200 & 17877    & 24.46      & 0             & 0.05  & 2200 & 22771    & 36.12      & 4.74          & 0.05  \\
A7  & 3000 & 36821    & 35.6       & 0             & 0.05  & 3200 & 36821    & 35.6       & 0             & 0.05  & 3000 & 40495    & 40.03      & 3.47          & 0.05  \\
A8  & 2900 & 68271    & 35.09      & 0             & 0.05  & 3000 & 69551    & 36.87      & 0             & 0.05  & 2900 & 71167    & 38.59      & 1.95          & 0.05  \\
A9  & 2300 & 22055    & 33.64      & 0             & 0.05  & 2400 & 22428    & 35.2       & 0             & 0.05  & 2300 & 26597    & 42.77      & 3.78          & 0.05  \\
A10 & 2800 & 35688    & 37.61      & 0             & 0.05  & 2800 & 37189    & 35.81      & 0             & 0.05  & 2800 & 40687    & 43.09      & 3.4           & 0.05  \\
A11 & 2300 & 29579    & 31.68      & 0             & 0.05  & 2300 & 29909    & 32.78      & 0             & 0.05  & 2300 & 32907    & 35.64      & 3.48          & 0.05  \\
A12 & 2600 & 15174    & 33.8       & 0             & 0.05  & 2600 & 15174    & 33.8       & 0             & 0.05  & 2600 & 17818    & 42.94      & 5.12          & 0.05  \\
A13 & 2200 & 98070    & 30.97      & 0             & 0.05  & 2200 & 98070    & 30.97      & 0             & 0.05  & 2200 & 105113   & 35.95      & 1.36          & 0.05  \\
A14 & 2200 & 101159   & 30.04      & 0             & 0.05  & 2200 & 101474   & 30.35      & 0             & 0.05  & 2200 & 108576   & 34.35      & 1.2           & 0.05  \\
A15 & 2100 & 113221   & 34.11      & 0             & 0.05  & 2400 & 111374   & 32.49      & 0             & 0.05  & 2100 & 116457   & 35.33      & 1.21          & 0.05  \\
A16 & 2500 & 16495    & 27.04      & 0             & 0.05  & 2500 & 19002    & 30.73      & 0             & 0.05  & 2500 & 20313    & 37.29      & 4.14          & 0.05  \\
A17 & 2300 & 11357    & 43.7       & 0             & 0.05  & 2300 & 14287    & 45.41      & 0             & 0.05  & 2300 & 12529    & 44.38      & 0.84          & 0.05  \\
A18 & 2300 & 28522    & 32.48      & 0             & 0.05  & 2600 & 28302    & 31.74      & 0             & 0.05  & 2300 & 33252    & 40.15      & 5.28          & 0.05  \\
A19 & 2600 & 20182    & 30.81      & 0             & 0.05  & 2600 & 20182    & 30.81      & 0             & 0.05  & 2600 & 23515    & 40.34      & 4.74          & 0.05  \\
A20 & 3200 & 8871     & 35.74      & 0             & 0.05  & 3200 & 8871     & 35.74      & 0             & 0.05  & 3200 & 8724     & 34.51      & 3.52          & 0.05  \\ \hline
Média  &   &          & 31.5125    &               & 0.05  &      &          & 31.8745    &               & 0.05  &      &          & 37.3205    &               & 0.05 
\end{tabular}
\label{tab:2}
\caption{Teste}
\end{sidewaystable}
2

1 Answer 1

9

An excerpt from page 2 of the user guide of the rotating package:

enter image description here

Your write-up strongly suggests that your document employs the twoside document class option, either directly or indirectly. If that's the case, load the rotating package

  • with the option figuresleft if you want sidewaystable and sidewaysfigure environments to be rotated uniformly clockwise; or, conversely,

  • with the option figuresright if you want sidewaystable and sidewaysfigure environments to be rotated uniformly counterclockwise.


Addendum: In addition to loading the rotating package with either figuresright or figuresleft, you may want to apply some edits to your tables to make them visually more attractive. For instance, you might (a) eliminate all vertical rules -- trust me, they're not needed; (b) use the macros of the booktabs package -- such as \toprule, \cmidrule, \midrule, \bottomrule, and \addlinespace -- instead of LaTeX's basic \hline directive; and (c) align the numbers on their (explicit or implicit) decimal markers.

It may seem like a lot of work, at first, to apply these visual improvements. However, the potential benefits are even more substantial: Readers are usually quite willing to take a closer look and absorb the contents of well-designed and -formatted tables. The same cannot be said for haphazardly produced tables.

enter image description here

\documentclass[twoside]{book} % or some other suitable document class
\usepackage[T1]{fontenc}
\usepackage[margin=2.5cm]{geometry} % set page paramerters appropriately
\usepackage[figuresright]{rotating}

\usepackage{booktabs} % for \toprule, \midrule, etc
\usepackage{siunitx} % for 'S' column type
\sisetup{group-digits=false}
% create 2 column types based on the 'S' column type:
\newcolumntype{T}[1]{S[table-format=#1]}
\newcolumntype{U}[1]{S[table-format=#1,
                       round-mode=places, % apply rounding automatically
                       round-precision=2]}

\begin{document}

\begin{sidewaystable}
\centering
\begin{tabular}{@{} l T{5.0} U{2.2} T{1.0} c
                      T{5.0} U{2.2} T{1.0} c
                      T{6.0} U{2.2} T{2.2} c @{}}
\toprule
Inst. & \multicolumn{4}{c}{FFF-W} 
      & \multicolumn{4}{c}{FFF-A} 
      & \multicolumn{4}{c@{}}{FFF-R} \\ 
\cmidrule(lr){2-5} \cmidrule(lr){6-9} \cmidrule(l){10-13}
& {Obj.} & {Desp.\ (\%)} & {$\sigma$} & {Tempo}
& {Obj.} & {Desp.\ (\%)} & {$\sigma$} & {Tempo} 
& {Obj.} & {Desp.\ (\%)} & {$\sigma$} & {Tempo} \\ 
\midrule
A1  &  1578 &  2.86 & 0 & 0.05 &  1578 & 2.86  & 0 & 0.05 &  1578 & 2.86  & 0    & 0.05 \\
A2  & 27990 & 13.13 & 0 & 0.05 & 27916 & 12.89 & 0 & 0.05 & 41613 & 42.23 & 5.3  & 0.05 \\
A3  & 17933 & 27.29 & 0 & 0.05 & 17788 & 26.48 & 0 & 0.05 & 21759 & 39.5  & 5.25 & 0.05 \\
A4  & 17933 & 27.29 & 0 & 0.05 & 17788 & 26.48 & 0 & 0.05 & 22342 & 38.21 & 4.94 & 0.05 \\
A5  & 25648 & 26.75 & 0 & 0.05 & 23158 & 23.06 & 0 & 0.05 & 28616 & 36.86 & 3.1  & 0.05 \\ 
\addlinespace
A6  & 19684 & 25.87 & 0 & 0.05 & 19684 & 25.87 & 0 & 0.05 & 23381 & 38.61 & 5.02 & 0.05 \\
A7  & 32034 & 28.24 & 0 & 0.05 & 32145 & 28.55 & 0 & 0.05 & 38003 & 38.09 & 3.67 & 0.05 \\
A8  & 61964 & 28.73 & 0 & 0.05 & 59812 & 28.01 & 0 & 0.05 & 68575 & 35.86 & 2.05 & 0.05 \\
A9  & 23465 & 39.52 & 0 & 0.05 & 23465 & 39.52 & 0 & 0.05 & 26058 & 41.4  & 3.04 & 0.05 \\
A10 & 29015 & 22.88 & 0 & 0.05 & 32783 & 29.54 & 0 & 0.05 & 38556 & 39.96 & 3.41 & 0.05 \\ 
\addlinespace
A11 & 26379 & 21.01 & 0 & 0.05 & 28519 & 28.14 & 0 & 0.05 & 33075 & 36.38 & 4.18 & 0.05 \\
A12 & 15015 & 32.91 & 0 & 0.05 & 16342 & 40.29 & 0 & 0.05 & 19038 & 43.49 & 5.72 & 0.05 \\
A13 & 80070 & 16.18 & 0 & 0.05 & 80070 & 16.18 & 0 & 0.05 & 97801 & 30.52 & 1.79 & 0.05 \\
A14 & 87501 & 18.87 & 0 & 0.05 & 86893 & 18.2  & 0 & 0.05 & 107166& 33.47 & 1.77 & 0.05 \\
A15 & 94424 & 20.92 & 0 & 0.05 & 95616 & 22.16 & 0 & 0.05 & 111726& 32.44 & 1.75 & 0.05 \\ 
\addlinespace
A16 & 15980 & 24.18 & 0 & 0.05 & 16817 & 28.83 & 0 & 0.05 & 20500 & 36.64 & 4.53 & 0.05 \\
A17 & 11357 & 43.7  & 0 & 0.05 & 13535 & 41.23 & 0 & 0.05 & 12772 & 42.59 & 1.23 & 0.05 \\
A18 & 26261 & 24.94 & 0 & 0.05 & 26261 & 24.94 & 0 & 0.05 & 34106 & 40.85 & 3.82 & 0.05 \\
A19 & 19636 & 28.54 & 0 & 0.05 & 19636 & 28.54 & 0 & 0.05 & 23245 & 40.33 & 4.11 & 0.05 \\
A20 &  9963 & 44.84 & 0 & 0.05 &  9963 & 44.84 & 0 & 0.05 & 10256 & 44.11 & 10.37& 0.05 \\ 
\midrule
Média & & 25.9325 & & 0.05 & & 26.8305 & & 0.05 & & 36.72 & & 0.05 \\
\bottomrule
\end{tabular}
\label{tab:1}
\caption{Teste}
\end{sidewaystable}

\begin{sidewaystable}
\centering
\begin{tabular}{@{} l c T{6.0} U{2.2} T{1.0} c
                      c T{6.0} U{2.2} T{1.0} c
                      c T{6.0} U{2.2} T{1.2} c @{}}
\toprule
Inst. & \multicolumn{5}{c}{SHP-W}
      & \multicolumn{5}{c}{SHP-A}
      & \multicolumn{5}{c@{}}{SHP-R} \\ 
\cmidrule(lr){2-6} \cmidrule(lr){7-11} \cmidrule(l){12-16}
& {H1}  & {Obj.} & {Desp.\ (\%)} & {$\sigma$} & {Tempo} 
& {H1}  & {Obj.} & {Desp.\ (\%)} & {$\sigma$} & {Tempo} 
& {H1}  & {Obj.} & {Desp.\ (\%)} & {$\sigma$} & {Tempo} \\
\midrule
A1  & 1600 &  1578 &  2.86 & 0 & 0.05 & 1600 &  1578 &  2.86 & 0 & 0.05 & 1600 &  1578 & 2.86  & 0    & 0.05 \\
A2  & 3600 & 36838 & 30.45 & 0 & 0.05 & 3500 & 36345 & 29.27 & 0 & 0.05 & 3500 & 46208 & 45.21 & 5.73 & 0.05 \\
A3  & 2300 & 21031 & 33.38 & 0 & 0.05 & 2300 & 21149 & 33.87 & 0 & 0.05 & 2300 & 22542 & 38.58 & 3.4  & 0.05 \\
A4  & 2300 & 21031 & 33.38 & 0 & 0.05 & 2300 & 21149 & 33.87 & 0 & 0.05 & 2300 & 22568 & 39.23 & 2.82 & 0.05 \\
A5  & 2400 & 27646 & 33.41 & 0 & 0.05 & 2300 & 28080 & 34.86 & 0 & 0.05 & 2400 & 30559 & 39.05 & 2.55 & 0.05 \\ 
\addlinespace
A6  & 2200 & 17877 & 24.46 & 0 & 0.05 & 2200 & 17877 & 24.46 & 0 & 0.05 & 2200 & 22771 & 36.12 & 4.74 & 0.05 \\
A7  & 3000 & 36821 & 35.6  & 0 & 0.05 & 3200 & 36821 & 35.6  & 0 & 0.05 & 3000 & 40495 & 40.03 & 3.47 & 0.05 \\
A8  & 2900 & 68271 & 35.09 & 0 & 0.05 & 3000 & 69551 & 36.87 & 0 & 0.05 & 2900 & 71167 & 38.59 & 1.95 & 0.05 \\
A9  & 2300 & 22055 & 33.64 & 0 & 0.05 & 2400 & 22428 & 35.2  & 0 & 0.05 & 2300 & 26597 & 42.77 & 3.78 & 0.05 \\
A10 & 2800 & 35688 & 37.61 & 0 & 0.05 & 2800 & 37189 & 35.81 & 0 & 0.05 & 2800 & 40687 & 43.09 & 3.4  & 0.05 \\  
\addlinespace
A11 & 2300 & 29579 & 31.68 & 0 & 0.05 & 2300 & 29909 & 32.78 & 0 & 0.05 & 2300 & 32907 & 35.64 & 3.48 & 0.05 \\
A12 & 2600 & 15174 & 33.8  & 0 & 0.05 & 2600 & 15174 & 33.8  & 0 & 0.05 & 2600 & 17818 & 42.94 & 5.12 & 0.05 \\
A13 & 2200 & 98070 & 30.97 & 0 & 0.05 & 2200 & 98070 & 30.97 & 0 & 0.05 & 2200 &105113 & 35.95 & 1.36 & 0.05 \\
A14 & 2200 &101159 & 30.04 & 0 & 0.05 & 2200 &101474 & 30.35 & 0 & 0.05 & 2200 &108576 & 34.35 & 1.2  & 0.05 \\
A15 & 2100 &113221 & 34.11 & 0 & 0.05 & 2400 &111374 & 32.49 & 0 & 0.05 & 2100 &116457 & 35.33 & 1.21 & 0.05 \\ 
\addlinespace
A16 & 2500 & 16495 & 27.04 & 0 & 0.05 & 2500 & 19002 & 30.73 & 0 & 0.05 & 2500 & 20313 & 37.29 & 4.14 & 0.05 \\
A17 & 2300 & 11357 & 43.7  & 0 & 0.05 & 2300 & 14287 & 45.41 & 0 & 0.05 & 2300 & 12529 & 44.38 & 0.84 & 0.05 \\
A18 & 2300 & 28522 & 32.48 & 0 & 0.05 & 2600 & 28302 & 31.74 & 0 & 0.05 & 2300 & 33252 & 40.15 & 5.28 & 0.05 \\
A19 & 2600 & 20182 & 30.81 & 0 & 0.05 & 2600 & 20182 & 30.81 & 0 & 0.05 & 2600 & 23515 & 40.34 & 4.74 & 0.05 \\
A20 & 3200 &  8871 & 35.74 & 0 & 0.05 & 3200 & 8871  & 35.74 & 0 & 0.05 & 3200 &  8724 & 34.51 & 3.52 & 0.05 \\ 
\midrule
Média & & & 31.5125 & & 0.05 & & & 31.8745 & & 0.05 & & & 37.3205 & & 0.05 \\
\bottomrule
\end{tabular}
\label{tab:2}
\caption{Teste}
\end{sidewaystable}

\end{document}
1
  • 3
    Thanks for your answer it's working the way I want now. I am pretty new with Latex so I had no idea about that. Commented Jan 4, 2020 at 2:34

You must log in to answer this question.

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