开发者

How to display my table "outside" an itemize structure so it will be centered in the page?

I have a document with an itemize structure and some table to display inside it. It have 3 subitem and the table is in the third one.

Here is an example:

\documentclass{article}%
\usepackage{amsmath}%
\usepackage{amsfonts}%
\usepackage{amssymb}%
\usepackage{graphicx}

\begin{document}
\begin{itemize}
  \item Item1
  \begin{itemize}
    \item Subitem1
    \begin{itemize}
      \item Subsubitem1
\begin{center}
\begin{tabular}{ |l|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c| }
\hline
S & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 & 25 & 26 & 27 & 28 \\
\hline
B & 1 & 1 & 1 & 1 & 0 & 开发者_如何转开发0 & 0 & 0 &  1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\hline
H & \multicolumn{4}{c|}{F} & \multicolumn{4}{c|}{0} &  \multicolumn{4}{c|}{F} & \multicolumn{4}{c|}{0} & \multicolumn{4}{c|}{0} \\
\hline
\end{tabular}
\end{center}    
      \item Subsubitem2
    \end{itemize}
    \item Subitem2
  \end{itemize}
  \item Item2
\end{itemize}   
\end{document}

My problem is, when I generate my document the table is aligned with the previous item while I would like it to be centered in the page.

I tried using \end{itemize} before the table and \begin{itemize} like that

\end{itemize}
\end{itemize}
\begin{center}
    %the table
\end{center}
\begin{itemize}
\begin{itemize}

but my compiler (pdflatex) generates an error "Something's wrong--perhaps a missing \item" at the second \begin{itemize}

I also tried to use a minipage

\begin{minipage}[c]{\textwidth}
\end{itemize}
\begin{center}
    %the table
\end{center}
\begin{itemize}
\end{minipage}

But with no more success.

So here is my question:

How to display my table "outside" the itemize so it will be centered in the page?

Thanks in advance


your first strategy works, you just missed one level of itemize (3, not 2).

\begin{document}
\begin{itemize}
  \item Item1
  \begin{itemize}
    \item Subitem1
    \begin{itemize}
      \item Subsubitem1
    \end{itemize}
  \end{itemize}
\end{itemize}

\begin{center}
[table]
\end{center}    

\begin{itemize}
  \item[] % we need an item here so make one with no bullet
  \begin{itemize}
    \item[] % as above
    \begin{itemize}
      \item Subsubitem2
    \end{itemize}
    \item Subitem2
  \end{itemize}
  \item Item2
\end{itemize}   
\end{document}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜