如何让表格适应横向模式

如何让表格适应横向模式

下面的方法对于常规表格非常有效。我想知道是否有命令短语可以在横向模式下缩小/调整表格大小。我认为问题出在 \textwidth 上,它在横向模式下显然不起作用。

\documentclass{article}
\usepackage{graphicx}
\begin{document}

\begin{table}
\resizebox{\textwidth}{!}{%
  \begin{tabular}{cc}
    Knuth & Lamport
  \end{tabular}}
\end{table}

\end{document}

该代码取自本论坛的以下链接。 更改表格中的字体大小

更新:

这是我的 MWE,它使用了 tabularx,但出于某种原因,我无法正确调整表格大小。在纵向模式下,使用 \resizebox 命令时文本变得太小。因此,我决定只将此页面设置为横向模式。

\documentclass[12pt]{report}
\usepackage{graphicx,xcolor}
\usepackage{caption}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage[version = 3]{mhchem}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{array}

\begin{document}
\begin{sidewaystable}
\caption{Kinetic parameters for oxygen reduction mechanism in MCFC cathode.}
\begin{tabularx}{\textwidth}{X|X|X|X|X|X|X|X}
\hline
\hline
\multicolumn{8}{c}{$i_o = i_o^o (O_2)^a (CO_2)^b$} \\
\multicolumn{8}{c}{$i_o$ = Bulk exchange current density, $mA/cm^2$} \\
\multicolumn{8}{c}{$i_o^o$ = Standard exchange current density, $mA/cm^2$} \\
\hline
 $i_o$ $mA/cm^2$ & a & b & Method & Electrode & Dominant Mechanism & Electrolyte &   Reference \\
\hline
 & 0.85 & -0.45 & Potential-step, AC Imped. & Au(ref), Ni(cathode) & Superoxide & 62/38 Li-K &  \\
 10,27,39 & 0.1 & -0.15 & Potential-step, Coul. relax., and AC Imped. & Au smooth & Superoxide & 43/57 Li-K eutectic & \\
11,26.3 & 0.1 & -0.15 & SS potentiostatic, potential step & Au smooth & Superoxide & Li, Li-K eutectic &  \\
0.023-0.065 & - & - & SS potentiostatic & Au smooth &  & Li-Na-K eutectic &  \\
10 & 0.15 & -0.15 & Potential-step & Au, smooth & Superoxide & & \\
- & 0.3 & 0 & SS, kinetic control assumed & NiO, porous &  & & Tang (1980) \\
- & 0.6 & 0.6 &  & NiO, porous &  & & Tang (1980) \\
~1 & 0.5 & 0 & C & NiO, porous & & &  \\
4-7 & - & - & Transient potentiostatic & Au & & & IGT Proj 9105 \\
0.78 & 0.2 & 0.2 & Modeling of SS data & NiO, porous & Peroxide & Na-K &  \\
0.16-0.5 & 0.875 & -0.25 & Modeling of SS data & NiO, porous & & &  \\
0.01-0.03 & - & - & Potential-sweep & Au & Peroxide & Na-K, Li &  \\    
& 0.375 & -1.25 & Modeling of SS data & NiO, porous &  & &  \\
& 0.4 & 0 & Modeling of SS data & SS porous & Superoxide & Li-Na-K, Li-K & This work \\
\hline  
\end{tabularx}
\end{sidewaystable} 
\end{document}

答案1

表格垂直方向太大,无法旋转;无论如何都需要减小字体大小。我得到了一个不错的结果

\documentclass[12pt]{report}
\usepackage{graphicx,xcolor}
\usepackage{caption}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[version = 3]{mhchem}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{array}
\usepackage{ragged2e}

\begin{document}
\begin{table}

\caption{Kinetic parameters for oxygen reduction mechanism in MCFC cathode.}

\scriptsize
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\begin{tabularx}{\textwidth}{@{}c|>{$}c<{$}|>{$}c<{$}|Y|Y|Y|Y|Y@{}}
\hline
\hline
\multicolumn{8}{c}{$i_o = i_o^o (O_2)^a (CO_2)^b$} \\
\multicolumn{8}{c}{$i_o$ = Bulk exchange current density, $mA/cm^2$} \\
\multicolumn{8}{c}{$i_o^o$ = Standard exchange current density, $mA/cm^2$} \\
\hline
 $i_o$ mA/cm$^2$ & a & b & Method & Electrode & Dominant Mechanism & Electrolyte &   Reference \\
\hline
 & 0.85 & -0.45 & Potential-step, AC Imped. & Au(ref), Ni(cathode) & Superoxide & 62/38 Li-K &  \\
 10,27,39 & 0.1 & -0.15 & Potential-step, Coul. relax., and AC Imped. & Au smooth & Superoxide & 43/57 Li-K eutectic & \\
11,26.3 & 0.1 & -0.15 & SS potentiostatic, potential step & Au smooth & Superoxide & Li, Li-K eutectic &  \\
0.023-0.065 & - & - & SS potentiostatic & Au smooth &  & Li-Na-K eutectic &  \\
10 & 0.15 & -0.15 & Potential-step & Au, smooth & Superoxide & & \\
- & 0.3 & 0 & SS, kinetic control assumed & NiO, porous &  & & Tang (1980) \\
- & 0.6 & 0.6 &  & NiO, porous &  & & Tang (1980) \\
~1 & 0.5 & 0 & C & NiO, porous & & &  \\
4-7 & - & - & Transient potentiostatic & Au & & & IGT Proj 9105 \\
0.78 & 0.2 & 0.2 & Modeling of SS data & NiO, porous & Peroxide & Na-K &  \\
0.16-0.5 & 0.875 & -0.25 & Modeling of SS data & NiO, porous & & &  \\
0.01-0.03 & - & - & Potential-sweep & Au & Peroxide & Na-K, Li &  \\    
& 0.375 & -1.25 & Modeling of SS data & NiO, porous &  & &  \\
& 0.4 & 0 & Modeling of SS data & SS porous & Superoxide & Li-Na-K, Li-K & This work \\
\hline  
\end{tabularx}
\end{table}
\end{document}

在此处输入图片描述

表中有几个问题,我修复了一些;但是化学元素的名称仍然是错误的,你应该用mchem命令来修复它们。

如果您决定使用旋转表,则可以使用\footnotesize

\documentclass[12pt]{report}
\usepackage{graphicx,xcolor}
\usepackage{caption}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[version = 3]{mhchem}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{mathptmx}
\usepackage{textcomp}
\usepackage{array}
\usepackage{ragged2e}

\begin{document}
\begin{sidewaystable}

\caption{Kinetic parameters for oxygen reduction mechanism in MCFC cathode.}

\footnotesize
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\begin{tabularx}{\textwidth}{@{}c|>{$}c<{$}|>{$}c<{$}|Y|Y|Y|Y|Y@{}}
\hline
\hline
\multicolumn{8}{c}{$i_o = i_o^o (O_2)^a (CO_2)^b$} \\
\multicolumn{8}{c}{$i_o$ = Bulk exchange current density, $mA/cm^2$} \\
\multicolumn{8}{c}{$i_o^o$ = Standard exchange current density, $mA/cm^2$} \\
\hline
 $i_o$ mA/cm$^2$ & a & b & Method & Electrode & Dominant Mechanism & Electrolyte &   Reference \\
\hline
 & 0.85 & -0.45 & Potential-step, AC Imped. & Au(ref), Ni(cathode) & Superoxide & 62/38 Li-K &  \\
 10,27,39 & 0.1 & -0.15 & Potential-step, Coul. relax., and AC Imped. & Au smooth & Superoxide & 43/57 Li-K eutectic & \\
11,26.3 & 0.1 & -0.15 & SS potentiostatic, potential step & Au smooth & Superoxide & Li, Li-K eutectic &  \\
0.023-0.065 & - & - & SS potentiostatic & Au smooth &  & Li-Na-K eutectic &  \\
10 & 0.15 & -0.15 & Potential-step & Au, smooth & Superoxide & & \\
- & 0.3 & 0 & SS, kinetic control assumed & NiO, porous &  & & Tang (1980) \\
- & 0.6 & 0.6 &  & NiO, porous &  & & Tang (1980) \\
~1 & 0.5 & 0 & C & NiO, porous & & &  \\
4-7 & - & - & Transient potentiostatic & Au & & & IGT Proj 9105 \\
0.78 & 0.2 & 0.2 & Modeling of SS data & NiO, porous & Peroxide & Na-K &  \\
0.16-0.5 & 0.875 & -0.25 & Modeling of SS data & NiO, porous & & &  \\
0.01-0.03 & - & - & Potential-sweep & Au & Peroxide & Na-K, Li &  \\    
& 0.375 & -1.25 & Modeling of SS data & NiO, porous &  & &  \\
& 0.4 & 0 & Modeling of SS data & SS porous & Superoxide & Li-Na-K, Li-K & This work \\
\hline  
\end{tabularx}
\end{sidewaystable} 
\end{document}

在此处输入图片描述

答案2

\documentclass{article}
\pagestyle{empty}

\usepackage[landscape,top=0pt,bottom=0pt,left=0pt,right=0pt]{geometry}
\usepackage{tabularx}

\begin{document}

\begin{table}
    \begin{tabularx}{\paperwidth}{|X|X|} % \textwidth also works
        \hline
        Knuth & Lamport \\
        \hline
    \end{tabularx}
\end{table}

\end{document}

相关内容