**preamble**
\documentclass[12pt]{amsart}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{graphicx}
\graphicspath{ {./documents/} }
\usepackage{array}
\usepackage{tabularx}
\geometry{a4paper}
\begin{document}
**table**
\begin{table}[]
\begin{tabular}{@{}ll@{}}
\toprule
Organisation & Role \\ \midrule
Courts & \begin{tabular}[c]{@{}l@{}}Judges and lawyers were Nazi members and enforced an improvised "Nazi law"\\ \\ Special courts set up to prosecute political crimes\end{tabular} \\
Gestapo & \begin{tabular}[c]{@{}l@{}}Secret state police set up by Göring in 1933. Himmler gained control after 1933, and by 1936, an established part of the SS\\ \\ Enforce political conformity, but relied on denunciations by the German population. In Würzburg, 54\% of race-related charges were initiated by private citizens.\end{tabular} \\
SS (Schutzstaffel - Defense Unit) & \begin{tabular}[c]{@{}l@{}}Private army and security system set up by Hitler's personal guards in 1925, led by Himmler after 1929. \\ \\ Key role in Kristallnacht -\textgreater replaced the SA as main military unit\\ \\ Enforce racial policy and run concentration camps\\ \\ Sub units: 1) Death's Head Units 2) Waffen SS\end{tabular} \\
SD (Sicherheitsdienst) & \begin{tabular}[c]{@{}l@{}}Set up in 1932 by Himmler\\ \\ Internal security force of SS. Main role was intelligence eg. reports of SD, popularity of party, situation of Church\end{tabular} \\
Concentration Camps & \begin{tabular}[c]{@{}l@{}}First used to detain political opponents (communists and socialists), later anybody who spoke out against the regime\\ \\ Forced labour from prisoners. Camps were then built near stone quarries and brick making factories\end{tabular} \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
当我编译时,它会截断页面。我尝试过查看其他堆栈交换解决方案,但它们对我不起作用(或者至少对我的个人故障排除不起作用)。tabularx 会在句子很长时自动创建新句子吗?
答案1
- 基于https://blog.modelworks.ch/automatic-line-breaks-in-latex-tables/。
- 您的代码很乱 :),例如,您加载了
tabularx
两次,又加载了geometry
两次。此外,**preamble**
开头的 还给我带来了额外的编译错误,我必须先找到它。 - 不确定为什么您使用
\begin{tabular}
inside\begin{tabular}
。 - 你也做了不是
tabularx
在您的代码中使用。
\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\begin{table}
\centering % not needed
\begin{tabularx}{\textwidth}{lX}
\toprule
Organisation & Role \\
\midrule
Courts & Judges and lawyers were Nazi members and enforced an improvised "Nazi law" Special courts set up to prosecute political crimes \\
\bottomrule
\end{tabularx}%
\label{tab:addlabel}%
\caption{A table with line breaks}
\end{table}%
\end{document}