
當我將表格寬度限制為 0.7\textwidth 時,它也會減少字體的大小。我希望表格顯示在頁面中央,但文字足夠大以便可讀。
\documentclass{exam}
\usepackage{adjustbox}
\begin{document}
\begin{center}
\begin{adjustbox}{width=0.7\textwidth}
\medskip\noindent
\begin{tabular}{|l|l|} \hline
Some text. & lsibyg gihebg fiehbg etin vtn osuing iostnugetnug etouhg otunhoeuthg thgu ituhg iotuhg ieuth guoierthg touhg uoth ut guotg uwht owuht \\\hline
\end{tabular}
\end{ajustbox}
\end{center}
\begin{tabular}{|l|l|} \hline
Some text. & lsibyg gihebg fiehbg etin vtn osuing iostnugetnug etouhg otunhoeuthg thgu ituhg iotuhg ieuth guoierthg touhg uoth ut guotg uwht owuht \\\hline
\end{tabular} \\
\end{document}
答案1
您不需要調整盒。只需指定表格寬度,第二列使用「段落」列類型,例如p{<width>}
或套件X
中定義的列類型tabularx
:
\documentclass{exam}
\usepackage{tabularx}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{center}
\begin{tabularx}{0.7\linewidth}{|l|X|} % <---
\hline
Some text. & lsibyg gihebg fiehbg etin vtn osuing iostnugetnug etouhg otunhoeuthg thgu ituhg iotuhg ieuth guoierthg touhg uoth ut guotg uwht owuht \\
\hline
\end{tabularx}
\bigskip
\begin{tabularx}{\linewidth}{|l|X|} % <---
\hline
Some text. & lsibyg gihebg fiehbg etin vtn osuing iostnugetnug etouhg otunhoeuthg thgu ituhg iotuhg ieuth guoierthg touhg uoth ut guotg uwht owuht \\
\hline
\end{tabularx}
\end{center}
\end{document}
(紅線表示頁面佈局)