I am using this command to put a box around stuff.
\newcommand{\cfbox}[1]{%
{\color{black}%
\setlength\fboxsep{0pt}\fbox{
\begin{varwidth}{\dimexpr\columnwidth-2}
\leavevmode{\color{black}#1}
\end{varwidth}
}
}%
}
The problem is that each block gets a different alignment, I wanted all of them to be aligned with the first block.
Also, not the core of the question but if anyone also knows: How do I center the caption of the table back? After using the command the text went to the left... (it is not necessary to answer this though).
Here's the example to run
\documentclass{acmart}
\usepackage[utf8]{inputenc}
\usepackage{varwidth}
\usepackage{tikz}
\newcommand{\cfbox}[1]{%
{\setlength\fboxsep{0pt}\fbox{
\begin{varwidth}{\dimexpr\columnwidth-2}
\leavevmode{\color{black}#1}
\end{varwidth}%
}
}
}
\begin{document}
\cfbox{
\cfbox{
\section{Introduction}
}
\cfbox{
If you are new to publishing with ACM, this document is a valuable
guide to the process of preparing your work for publication. If you
have published with ACM before, this document provides insight and
instruction into more recent changes to the article template.
}
}
\cfbox{
\begin{table}[H]
\caption{Frequency of Special Characters}
\label{tab:freq}
\cfbox{
\begin{tabular}{ccl}
\toprule
Non-English or Math&Frequency&Comments\\
\midrule
\O & 1 in 1,000& For Swedish names\\
$\pi$ & 1 in 5& Common in math\\
\$ & 4 in 5 & Used in business\\
$\Psi^2_1$ & 1 in 40,000& Unexplained usage\\
\bottomrule
\end{tabular}
}
\end{table}
}
\cfbox{
\begin{table}[H]
\caption{Frequency of Special Characters}
\label{tab:freq}
\cfbox{
\begin{tabular}{ccl}
\toprule
Non-English or Math&Frequency&Comments\\
\midrule
\O & 1 in 1,000& For Swedish names\\
$\pi$ & 1 in 5& Common in math\\
\$ & 4 in 5 & Used in business\\
$\Psi^2_1$ & 1 in 40,000& Unexplained usage\\
\bottomrule
\end{tabular}
}
\end{table}
}
\end{document}

%, but without a fully compilable MWE including\documentclassand the appropriate packages that reproduces the problem, it is difficlut to test. Try replacing\fbox{with\fbox{%for instance. Probably need some more after a trailing}. – Peter Grill Jun 09 '20 at 23:12?
after _any_ error you should not even look at the pdf output it is not intended to be usable just a debugging aid at best.\dimexpr\columnwidth-2` is a syntax error (no units on the 2 ) but I can not guess what expression you intended there.%at the ends of lines the extra space is causing the boxes to be too big as you can see in the output – David Carlisle Jun 10 '20 at 00:12