我在 Word 中有一张表格,我想用代码将其添加到 overleaf 中。我试过一个,但句子太长,看起来很奇怪。我希望它和文本一样长,或者可能稍微短一点,但不居中。我已附上图片,有什么解决办法吗?
我尝试了这个代码:
\begin{table}
\begin{tabularx}{430pt}{|c|X|}
\hline
\textbf{Paragraph \#} & \textbf{Description:} \\
\hline
1 & \pbox{20cm}{\emph{Rhetorical questions/Introduction} \\
Why get someone who only \emph{pretends} to be a doctor when you
could get a real one? \\ \emph{Relate to audience} \\ Some more sentence
here.} \\
\end{tabularx}
\end{table}
但效果不太好。
答案1
像这样吗?
注意使用\par
指令强制在给定列内换行。还请注意,X
列类型允许自动换行。
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{table}
\setlength\extrarowheight{2pt} % for a more open "look"
\begin{tabularx}{\textwidth}{|c|X|}
\hline
\textbf{Paragraph \#} & \textbf{Description} \\
\hline
1 & \emph{Rhetorical questions\slash Introduction} \par
Why get someone who only \emph{pretends} to be a doctor when you
could get a real one? \par
\emph{Relate to audience} \par
Some more sentences here. \\
\hline
\end{tabularx}
\end{table}
\end{document}
答案2
\documentclass[12pt]{article} \begin{document} \begin{tabular}{p{6cm}|p{6cm}}\hline 溶液&实验方案\\hline 碱性裂解剂&25mM NAOH 0.2 mM EDTA pH[12]\\hline \end{tabular}
\end{document} % 您可以在结束表格之前添加剩余的行