latex - 如何将表格向左移动或不超过右边距?
问题描述
我在课堂上使用 Overleaf 做笔记,但在尝试创建表格列时遇到了麻烦。我的代码如下:
\begin{center}
\begin{tabular}{|c|c|}
\hline
Crystalline Solids & Non-Crsytalline Solids \\
\hline
i. Atoms and molecules are periodic in space & i. Atoms and molecules are not periodic in space \\
\hline
ii. Some crystalline solids are anisotopic \\
i.e the magnitudes of the physical properties like \\
refractive index, electrical conductivity are \\
different along difference directions \\ & ii. Physical properties are isotropic \\
\hline
iii. Have sharp melting points & iii. Do not have sharp boiling points - a range is present \\
\hline
iv. Breaks are observed in the cooling curve & iv. No breaks in cooling curve \\
\hline
v. Breaks along sharp edges i.e breaks \\
along specific "crystallographic planes" & v. Broken surfaces are irregular because there are no crystal planes \\
\hline
\end{tabular}
\end{center}
问题是现在我的桌子看起来像这样。https://imgur.com/ZrWFNSS
我已经尝试过使用\begin{table}
环境和\begin{figure}
环境,但即使在使用限定符之后,[h]
或者[ht]
表格在文本中的位置也发生了变化,并且对齐仍然关闭。如何更正它以使其适合页面?
解决方案
c
,l
并且r
列不包装它们的内容。您必须为您的 使用固定宽度的p{<len>}
列tabular
,或考虑使用tabularx
.
这是一个带有p
aragraph 样式列规范的选项:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{center}
\begin{tabular}{ l p{.45\linewidth} p{.45\linewidth} }
\toprule
& \multicolumn{1}{c}{Crystalline Solids} &
\multicolumn{1}{c}{Non-Crystalline Solids} \\
\midrule
i. & Atoms and molecules are periodic in space &
Atoms and molecules are not periodic in space \\
ii. & Some crystalline solids are anisotopic \textit{i.e.}~the magnitudes of the physical properties
like refractive index, electrical conductivity are different along difference directions &
Physical properties are isotropic \\
iii. & Have sharp melting points &
Do not have sharp boiling points --- a range is present \\
iv. & Breaks are observed in the cooling curve &
No breaks in cooling curve \\
v. & Breaks along sharp edges i.e breaks along specific ``crystallographic planes'' &
Broken surfaces are irregular because there are no crystal planes \\
\bottomrule
\end{tabular}
\end{center}
\end{document}
这是一个类似的选项,使用tabularx
:
\documentclass{article}
\usepackage{tabularx,booktabs}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{ l X X }
\toprule
& \multicolumn{1}{c}{Crystalline Solids} &
\multicolumn{1}{c}{Non-Crystalline Solids} \\
\midrule
i. & Atoms and molecules are periodic in space &
Atoms and molecules are not periodic in space \\
ii. & Some crystalline solids are anisotopic \textit{i.e.}~the magnitudes of the physical properties
like refractive index, electrical conductivity are different along difference directions &
Physical properties are isotropic \\
iii. & Have sharp melting points &
Do not have sharp boiling points~--- a range is present \\
iv. & Breaks are observed in the cooling curve &
No breaks in cooling curve \\
v. & Breaks along sharp edges i.e breaks along specific ``crystallographic planes'' &
Broken surfaces are irregular because there are no crystal planes \\
\bottomrule
\end{tabularx}
\end{document}
推荐阅读
- python - 如何在pyspark中将数据框附加在一起?
- android-studio - Android studio 安装文件夹无法识别
- php - php从数组中获取错误以卷曲url获取文件
- android - 如何使用 fastlane android 自动递增变量和 versionCode?
- python - Cloud Storage - 获取文件的实际创建日期
- arduino - 如何解决此错误:C:\Users\HP\Documents\Arduino\libraries\arduino-lmic-master\src\lmic\radio.c:689
- java - Android - 通过文本查找 ListView 项的索引
- php - 如何更改电子邮件标题中的内容类型
- javascript - 选择下拉值时,在文本框中显示状态
- tensorflow - 如何在 TensorFlow Lite Model Maker 中指定扩充?