1

Good morning/afternoon/evening

I have got this source code, below. The result is on the picture on the left. Why is the mark (the black circle) below the table? How to fix it? I want to have got the mark next to the table - top or middle (at one level).

I had to use table before tabular because compiler gave me an error message, the picture on the right. I have read some text on this forum and their advice was to use table. But the problem stayed. How to repair it?

Thank you for help.

\documentclass[10pt,a6paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[main=english,slovak]{babel}
\usepackage[cm]{fullpage}
\usepackage[a6paper, top=10mm, left=10mm, right=10mm, 
bottom=10mm,foot=5mm,marginparsep=0mm,showframe]{geometry}
\usepackage{tipa}
\usepackage{tabularx,booktabs}
\usepackage{multirow}

\begin{document}

  \begin{itemize}
    \item some text    
    \item    
         \begin{table}[h!]
         \centering
         \begin{tabular}{l l}
             & {\multicolumn{1}{c}{Otázka}}  \\
             & {\multicolumn{1}{c}{\sffamily{Question}}}  \\
            \toprule
            \sffamily{I am \ldots .}     & \sffamily{Am I \ldots ?}\\
            \sffamily{You are \ldots .}  & \sffamily{Are you \ldots ?}\\
            \sffamily{He is \ldots .}    & \sffamily{Is he \ldots ?}\\
            \sffamily{She is \ldots .}   & \sffamily{Is she \dots ?}\\
            \sffamily{It is \ldots .}    & \sffamily{Is it \ldots ?}\\
            \sffamily{We are \ldots .}   & \sffamily{Are we \ldots ?}\\
            \sffamily{You are \ldots .}  & \sffamily{Are you \ldots ?}\\
            \sffamily{They are \ldots .} & \sffamily{Are they \ldots ?}\\
            \bottomrule
         \end{tabular}
         \end{table     

    \item some text
\end{itemize}            

\end{document}

On the left - page, on the right - a message after compile

  • 1
    You've forgot the } at the end of \end{table}... But to answer your question,i guess Latex moves the item marker below the table because there is no text (other than in the table environment). If you dont want to write something there you can just do the quick&dirty work arround of adding a space in textmath: $ $ It's not pretty. Especially because It uses the usual vspace between text and the beginning of a table. So the point floats there somehow pointless... – SeverinBang Jul 16 '16 at 08:59
  • definitly not. I would normaly not recommend it, but in your case might the best way to move the item markers to the middle of each item instead of the top... (I'm sure there is a way to do that, latex always allows you to mess up everything...) – SeverinBang Jul 16 '16 at 09:10
  • I have written symbols $$ behind \item and the mark is now on the right place. But the second problem is still here. \omit ? I have no idea how to fix it. – Ľubomír Masarovič Jul 16 '16 at 09:15
  • i just deleted the multicolumn part, so the two lines above the headrule are flush left too, but it compiles without errors. Sorry that i can provide you only with thous unsatisfying answers right now... – SeverinBang Jul 16 '16 at 09:24
  • Yes. But I need a less vertical space between the mark and the table. – Ľubomír Masarovič Jul 16 '16 at 09:41
  • \vspace{-xmm} would be a possibility... (i don't like it though) – SeverinBang Jul 16 '16 at 09:47

1 Answers1

1

With a table environment, centring is done w.r.t. the line width, not the width allotted to the content of the item. To centre in the second case, you can use a minipageof an adjusted width. Compare:

\documentclass[10pt,a6paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[main=english,slovak]{babel}
\usepackage[cm]{fullpage}
\usepackage[a6paper,
        top=10mm, left=10mm, right=10mm,
        bottom=10mm, foot=5mm, marginparsep=0mm,
        showframe]{geometry}
\usepackage{tipa}
\usepackage{tabularx,booktabs}
\usepackage{multirow}
\usepackage{caption} %

\begin{document}
\begin{itemize}
\item some text some text some text some text some text some text some text some text
\item %
\begin{minipage}[t]{\dimexpr\linewidth-\itemindent\relax}\centering
\begin{tabular}[t]{>{\sffamily}l >{\sffamily}l}
& \multicolumn{1}{c}{Otázka} \\
& \multicolumn{1}{c}{\sffamily{Question}} \\
\toprule
I am \ldots & Am I \ldots ?\\
You are \ldots & Are you \ldots ?\\
He is \ldots & Is he \ldots ?\\
She is \ldots & Is she \dots ?\\
It is \ldots & Is it \ldots ?\\
We are \ldots & Are we \ldots ?\\
You are \ldots & Are you \ldots ?\\
They are \ldots & Are they \ldots ?\\
\bottomrule
\end{tabular}
\captionof{table}{Some caption}
\end{minipage}
\\
\item %
\leavevmode\vspace*{-\dimexpr\baselineskip+\topsep\relax}
\begin{table}[!h]
\centering
    \begin{tabular}[t]{>{\sffamily}l >{\sffamily}l}
                    & \multicolumn{1}{c}{Otázka} \\
                    & \multicolumn{1}{c}{\sffamily{Question}} \\
    \toprule
I am \ldots & Am I \ldots ?\\
You are \ldots & Are you \ldots ?\\
He is \ldots & Is he \ldots ?\\
She is \ldots & Is she \dots ?\\
It is \ldots & Is it \ldots ?\\
We are \ldots & Are we \ldots ?\\
You are \ldots & Are you \ldots ?\\
They are \ldots & Are they \ldots ?\\
            \bottomrule
         \end{tabular}
\caption{Some caption}
          \end{table}

    \end{itemize}

\end{document} 

enter image description here

Bernard
  • 271,350