1

I am creatin a table with latex using ACM template with \documentclass[sigconf, anonymous]{acmart} This is my code:

\begin{table}
\centering
\begin{tabulary}{\textwidth}{CLCL}
\toprule
\multicolumn{2}{c}{Security} & 
\multicolumn{2}{c}{Data protection} \\\cmidrule(rl){1-2}\cmidrule(rl){3-4}
Level & \hfil Mode & Encryption & \hfil Authenticity\\
%\midrule
\cmidrule(rl){1-1}\cmidrule(rl){2-2}\cmidrule(rl){3-3}\cmidrule(rl){4-4}
  0 & No Security     & No  &  Not validated   \\
  1 & AES-CBC-MAC-32  & No  &  32-bit MIC \\   
  2 & AES-CBC-MAC-64  & No  &  64-bit MIC   \\   
  3 & AES-CBC-MAC-128 & No  &  128-bit MIC  \\   
  4 & AES-CTR         & Yes &  Not validated       \\   
  5 & AES-CCM-32      & Yes &  32-bit MIC     \\   
  6 & AES-CCM-64      & Yes &  64-bit MIC     \\   
  7 & AES-CCM-128     & Yes &  128-bit MIC    \\
  \bottomrule
\end{tabulary}
\end{table}

Initially, with IEEE template I got:

enter image description here

but with the ACM, I got this:

enter image description here

  • Welcome to TeX.SE. The ACM provides several LaTeX document classes. Please be more specific as to which document class you employ. – Mico Jan 23 at 23:06
  • @Mico could please see the edited question? – dina Jan 23 at 23:10
  • 1
    Thanks for providing the additional piece of information. I'm afraid I cannot reproduce the issue you're experiening, i.e., the table looks exactly like one would expect. Please tell us more about which packages (other than tabulary and booktabs) you load in the document's preamble. – Mico Jan 23 at 23:17
  • @Mico you got 1 out of 2 right:-) – David Carlisle Jan 23 at 23:27
  • Just replace \begin{tabulary}{\textwidth}{CLCL} into \begin{tabular}{clcl} and \end{tabulary} with \end{tabular}. – egreg Jan 23 at 23:32
3

enter image description here

If you get a TeX error then you should not even look at the PDF, look at the log, your log will show

! LaTeX Error: Environment tabulary undefined.

as tabulary is not defined. (You must have loaded booktabs though otherwise the output would not have the horizontal rules).

You need

\usepackage{tabulary}

\documentclass{article}
\usepackage{booktabs}
\begin{document}

\begin{table}
\centering
\begin{tabulary}{\textwidth}{CLCL}
\toprule
\multicolumn{2}{c}{Security} & 
\multicolumn{2}{c}{Data protection} \\\cmidrule(rl){1-2}\cmidrule(rl){3-4}
Level & \hfil Mode & Encryption & \hfil Authenticity\\
%\midrule
\cmidrule(rl){1-1}\cmidrule(rl){2-2}\cmidrule(rl){3-3}\cmidrule(rl){4-4}
  0 & No Security     & No  &  Not validated   \\
  1 & AES-CBC-MAC-32  & No  &  32-bit MIC \\   
  2 & AES-CBC-MAC-64  & No  &  64-bit MIC   \\   
  3 & AES-CBC-MAC-128 & No  &  128-bit MIC  \\   
  4 & AES-CTR         & Yes &  Not validated       \\   
  5 & AES-CCM-32      & Yes &  32-bit MIC     \\   
  6 & AES-CCM-64      & Yes &  64-bit MIC     \\   
  7 & AES-CCM-128     & Yes &  128-bit MIC    \\
  \bottomrule
\end{tabulary}
\end{table}
\end{document}
  • @Zarko the posted code is the source of the posted image, it answesr the OPs question "Why do I get this weird output" showing that it is not as the OP guessed due to the acm class, but can be obtained from article if as shown you ignore errors and don't load needed packages. – David Carlisle Jan 24 at 7:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.