如果我想在表格中增加新行,该如何阻止“不良行为”?

如果我想在表格中增加新行,该如何阻止“不良行为”?

错误信息我想创建一个表格,每个句子都有新行。使用\\不起作用,因为那是为新表格行保留的。相反,我使用\newline\linebreak可以完美地完成工作,只是控制台有错误消息Underfull \hbox (badness 8703) in paragraph...。这“不好”吗?它完成了工作。

以下是我桌上的一个例子

 \subsection{Social Change}
\underline{Major Social Developments under Mao} 
\begin{table}[H]
\setlength{\tabcolsep}{0.4cm}
\renewcommand{\arraystretch}{1.5}
\hskip-2.7cm\begin{tabular}{p{2.5cm}p{8.1cm} p{7cm}}
\hline

`Education & Learning should come from experience \linebreak Economic development could be stimulated by large numbers of skilled specialists and improving mass literacy \linebreak Young people encouraged to learn from the peasants   
& Rejected traditional education for elitism, old-fashioned teaching methods and reliance on books\newline Opposed Western influence - cultural imperialism \\

答案1

目前还不清楚你想要什么输出,但运行起来没有任何警告

在此处输入图片描述

\documentclass[a4paper,landscape]{article}

\usepackage{graphicx,array}

\begin{document}

 \subsection{Social Change}
\underline{Major Social Developments under Mao}% underline, really?
 
\begin{table}[htp]%[H]
\setlength{\tabcolsep}{0.4cm}
\renewcommand{\arraystretch}{1.5}
\hspace*{-4cm}\begin{tabular}{
p{2.5cm}
>{\raggedright\arraybackslash}p{8.1cm}
>{\raggedright\arraybackslash}p{7cm}}
\hline

 Education & Learning should come from experience Economic development could be stimulated by large numbers of skilled specialists and improving mass literacy  Young people encouraged to learn from the peasants   
 & Rejected traditional education for elitism, old-fashioned teaching methods and reliance on books
Opposed Western influence --- cultural imperialism
\end{tabular}\hspace*{-4cm}
\end{table}

\end{document}

答案2

您可以使用左对齐\Longunderstack来手动设置换行符。我还展示了如何通过设置行之间的基线跳跃\setstackgap{L}{<length>}

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{stackengine}
\setstackEOL{\\}
\begin{document}
 \subsection{Social Change}
\underline{Major Social Developments under Mao} 
\begin{table}[ht]
\setlength{\tabcolsep}{0.4cm}
\renewcommand{\arraystretch}{1.5}
\hskip-2.7cm\begin{tabular}{p{2.1cm}p{8.1cm} p{7.4cm}}
\hline
Education & \Longunderstack[l]{
  Learning should come from experience \\
  Economic development could be stimulated\\
   by large numbers of skilled specialists \\
  and improving mass literacy \\
Young people encouraged to learn from the\\
   peasants }
& \setstackgap{L}{1.3\normalbaselineskip}
\Longunderstack[l]{
  Rejected traditional education for elitism, old-\\
  fashioned teaching methods and reliance on books\\
 Opposed Western influence---cultural imperialism }
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

相关内容