在 \centering 之後返回合理的最佳方法是什麼?

在 \centering 之後返回合理的最佳方法是什麼?

這是一個過於簡化的例子。我的問題是\justifyand/or\clearpage在第一\item行創建一個錯誤,提示“可能缺少 \item”。我在本節上方使用了類似的程式碼序列,沒有錯誤;然而,它是一個表格,文本,另一個表格。我想知道是否有一種更有效的方法可以在我的\centering表格或圖形之後返回文本以使其合理並且看起來像我的文檔的其餘部分。另外,錯誤是由於另一個包還是枚舉而發生的?

\documentclass[draft]{article}
\usepackage[showframe]{geometry}
\usepackage{ragged2e}
\usepackage{adjustbox}
\usepackage{caption}
\begin{document}
\paragraph{Paragraph 1}
Filler text is here. \\ 

\centering
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{|c|c|}
\hline
Filler & Whatever \\
\hline
\end{tabular} 
\end{adjustbox}
\captionof{figure}{Filling for Figure}

\justify
\paragraph{Paragraph 2}
Filler Text


\centering
\captionof{table}{Table 1}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{|c|c|}
\hline 
x & 1  \\ 
\hline
y & 3 \\
\hline
\end{tabular} 
\end{adjustbox}

\clearpage %Adding this errors out
\justify %Or this

\paragraph{Paragraph 3} 
Filler text to show up.
\begin{enumerate}
\item Function
\item Filler Text
\end{enumerate}
\end{document}

編輯 1:使文件包含正確的套件。

編輯 2:文件現在在包含 2 行註解時會出錯。我的總體目標是擁有所有三個段落,並且枚舉清單與“正常”文件一樣合理。兩個表格及其標題應按原樣居中。

答案1

正如評論中已經指出的那樣,您應該使用\justifying, not \justify(該命令的存在只是因為 LaTeX 如何實現環境的副作用justify)。

相關內容