TeX - LaTeX Asked on March 29, 2021
I am trying to typeset a table with very long paragraphs. Due to the nature of the work, the table must not be divided into smaller ones. I want the following to be satisfied
The picture provided above is simply the result of rotating the table using a PDF viewer.
geometry
package.However, it must be flexibly changed by the user. This is important since the option width=1.1textwidth
in adjustbox
environment enlarges the area available for the table to be typeset in. Thus, I might want to increase the size of the table, but I also want it to remain at the center of the page.
In the provided code, however, it is easy to see how the table has very small margin with the left edge of the page
emptytablepage
must be executed for the page at which the table existsNote: in the code provided, when I remove the command clearpage
, the direction at which the table is typeset changes. What is the explanation for this?
I tried to apply what is in How to change certain pages into landscape/portrait mode. However, the package typearea
seems to change the general layout of pages, which is not desired for my work (i.e., I want the geometry of my page to remain exactly the same)
documentclass{book}
usepackage{ragged2e}
% ========== Caption packages ==========
usepackage{caption}
% ========== Table packages ==========
usepackage{tabularx}
% BEGIN_FOLD
newcolumntype{J}{ >{arraybackslashjustifying} X }
def tabularxcolumn#1{m{#1}}
% END_FOLD
usepackage{booktabs}
usepackage{makecell}
usepackage[flushleft]{threeparttable}
usepackage[]{rotating}
usepackage{adjustbox}
% ========== Figures and tables locations packages ==========
usepackage{float}
usepackage{blindtext}
usepackage{fancyhdr}
fancypagestyle{emptytablepage}{
renewcommand{headrulewidth}{0pt}
fancyhead{}
fancyfoot{}
}
pagestyle{emptytablepage}
begin{document}
blindtext
clearpage
begin{sidewaystable*}[p]
caption{Classifications of Strategies}
label{table:strategies_names_definitions}
centering
renewcommand{arraystretch}{1}
begin{adjustbox}{width=1.1textwidth, center}
begin{tabularx}{textwidth}{r c c J c}
toprule
multicolumn{3}{c}{Strategy} &
multicolumn{2}{c}{Definition and References that Discuss/Propose the Strategy}
cmidrule(r){1-3} cmidrule(l){4-5}
&
multicolumn{2}{c}{Name and Abbreviation} &
multicolumn{1}{c}{Definition}
& References
cmidrule(r){2-3} cmidrule(lr){4-4} cmidrule(lr){5-5}
1. &
Name A &
Class A &
blindtext &
addlinespace[0.3cm]
2. &
Name B &
Class B &
blindtext &
3. &
Name C &
Class C &
blindtext &
bottomrule
end{tabularx}
end{adjustbox}
end{sidewaystable*}
blindtext
end{document}
The easiest solution is to use TikZ and (current page.center). See also Draw at extreme page on landscape page and How to keep section heading and footnotes on a landscape table
Note that the minipage
(used to center the contents) changes textwidth
, hence dimen0
. Also, sidewaystable
and tikz[remember picture]
are not compatible.
documentclass{book}
usepackage{ragged2e}
% ========== Caption packages ==========
usepackage{caption}
% ========== Table packages ==========
usepackage{tabularx}
% BEGIN_FOLD
newcolumntype{J}{ >{arraybackslashjustifying} X }
def tabularxcolumn#1{m{#1}}
% END_FOLD
usepackage{booktabs}
usepackage{makecell}
usepackage[flushleft]{threeparttable}
usepackage[]{rotating}
usepackage{adjustbox}
% ========== Figures and tables locations packages ==========
usepackage{float}
usepackage{blindtext}
usepackage{fancyhdr}
fancypagestyle{emptytablepage}{
renewcommand{headrulewidth}{0pt}
fancyhead{}
fancyfoot{}
}
pagestyle{emptytablepage}
usepackage{tikz}
begin{document}
blindtext
begin{table*}[p]
dimen0=textwidth
sbox0{begin{minipage}[c][paperheight][c]{paperwidth}% fill entire page
caption{Classifications of Strategies}
label{table:strategies_names_definitions}
centering
renewcommand{arraystretch}{1}
begin{adjustbox}{width=1.1dimen0, center}
begin{tabularx}{textwidth}{r c c J c}
toprule
multicolumn{3}{c}{Strategy} &
multicolumn{2}{c}{Definition and References that Discuss/Propose the Strategy}
cmidrule(r){1-3} cmidrule(l){4-5}
&
multicolumn{2}{c}{Name and Abbreviation} &
multicolumn{1}{c}{Definition}
& References
cmidrule(r){2-3} cmidrule(lr){4-4} cmidrule(lr){5-5}
1. &
Name A &
Class A &
blindtext &
addlinespace[0.3cm]
2. &
Name B &
Class B &
blindtext &
3. &
Name C &
Class C &
blindtext &
bottomrule
end{tabularx}
end{adjustbox}
end{minipage}}%
tikz[remember picture,overlay]{node[rotate=90] at (current page.center) {usebox0};}
end{table*}
clearpage
blindtext
end{document}
Answered by John Kormylo on March 29, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP