控制表格列宽与文字换行

控制表格列宽与文字换行

表格中的第二列超出了右边距。有没有办法在不调整表格大小的情况下控制这个问题?我希望此列中的文本换行。

\begin{table}[htbp]
  \centering
  \caption{My table}
    \begin{tabular}{lp{30.215em}}
    \textbf{Reason} & \multicolumn{1}{l}{\textbf{Explanation}} \\
    \hline
    \hline
    \textbf{Advancement} & Individual seeks academic progress and wants to secure the best possible education for oneself \\
    \hline
    \textbf{Bandwagon Thinking} & Individual participates in private tutoring as a result of influence of parents, peers, societal trends and mass media  \\
    \hline
    \textbf{Cookie-cutter} & Individual seeks one-shot solutions (ready-made answers, shortcuts, notes, question banks) to academic concerns  \\
    \hline
    \textbf{Cutting edge} & \multicolumn{1}{l}{Individual seeks superiority over classmates/peers} \\
    \hline
    \textbf{Deficit-Oriented} & Individual recognizes academic inadequacies and lack of academic support at school/home, and seeks said support from tutoring providers \\
    \hline
    \textbf{Forward looking } & Individual seeks tangible and intangible benefits in the future (high academic ranks, good job, favourable social status) \\
    \hline
    \end{tabular}
\end{table}

答案1

使用tabularx,您可以自动将表格调整为当前文本宽度。在下面的 MWE 中,我还包含了第二个设计略有不同的表格:

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}

\usepackage{calc} % for second example only
\usepackage{booktabs}  % for second example only
\begin{document}

\begin{table}
  \centering
  \caption{My table}
    \begin{tabularx}{\textwidth}{lX}
    \textbf{Reason} & \textbf{Explanation} \\
    \hline
    \hline
    \textbf{Advancement} & Individual seeks academic progress and wants to secure the best possible education for oneself \\
    \hline
    \textbf{Bandwagon Thinking} & Individual participates in private tutoring as a result of influence of parents, peers, societal trends and mass media  \\
    \hline
    \textbf{Cookie-cutter} & Individual seeks one-shot solutions (ready-made answers, shortcuts, notes, question banks) to academic concerns  \\
    \hline
    \textbf{Cutting edge} & Individual seeks superiority over classmates/peers \\
    \hline
    \textbf{Deficit-Oriented} & Individual recognizes academic inadequacies and lack of academic support at school/home, and seeks said support from tutoring providers \\
    \hline
    \textbf{Forward looking } & Individual seeks tangible and intangible benefits in the future (high academic ranks, good job, favourable social status) \\
    \hline
    \end{tabularx}
\end{table}

\begin{table}
  \centering
  \caption{My table}
    \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}p{\widthof{Advancement}}X}
    \toprule
    Reason & Explanation \\
   \midrule
    Advancement & Individual seeks academic progress and wants to secure the best possible education for oneself \\
    \addlinespace
    Bandwagon Thinking & Individual participates in private tutoring as a result of influence of parents, peers, societal trends and mass media  \\ 
    \addlinespace
    Cookie-cutter & Individual seeks one-shot solutions (ready-made answers, shortcuts, notes, question banks) to academic concerns  \\
    \addlinespace
    Cutting edge & Individual seeks superiority over classmates/peers \\
    \addlinespace
    Deficit-Oriented & Individual recognizes academic inadequacies and lack of academic support at school/home, and seeks said support from tutoring providers \\
    \addlinespace
    Forward looking & Individual seeks tangible and intangible benefits in the future (high academic ranks, good job, favourable social status) \\
    \bottomrule
    \end{tabularx}
\end{table}

\end{document}

答案2

\documentclass[10pt,a4paper]{article}

\begin{document}
     \begin{tabular}{lp{9cm}}
        \textbf{Reason} & \multicolumn{1}{l}{\textbf{Explanation}} \\
        \hline
        \hline
        \textbf{Advancement} & Individual seeks academic progress and wants to secure the best possible education for oneself \\
        \hline
        \textbf{Bandwagon Thinking} & Individual participates in private tutoring as a result of influence of parents, peers, societal trends and mass media  \\
        \hline
        \textbf{Cookie-cutter} & Individual seeks one-shot solutions (ready-made answers, shortcuts, notes, question banks) to academic concerns  \\
        \hline
        \textbf{Cutting edge} & \multicolumn{1}{l}{Individual seeks superiority over classmates/peers} \\
        \hline
        \textbf{Deficit-Oriented} & Individual recognizes academic inadequacies and lack of academic support at school/home, and seeks said support from tutoring providers \\
        \hline
        \textbf{Forward looking } & Individual seeks tangible and intangible benefits in the future (high academic ranks, good job, favourable social status) \\
        \hline
    \end{tabular}
\end{document}

相关内容