I'm writing a thesis where I define some computational problems and I want them all to have the usual style presented in textbooks. Something like this:
I defined a command to do this easily as a table where I input the details of the problem each time. My code is as follows:
\newcommand{\problemStatement}[3]{
\begin{table}[]
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{llrl}
\cmidrule(lr){2-3}\hspace{1cm} & \multicolumn{2}{c}{#1} & \hspace{1cm} \\
\cmidrule(lr){2-3} & \textbf{Input} & #2 & \\
& \textbf{Question} & #3 &
\end{tabular}%
}
\end{table}
}
so that, for example, writing
\problemStatement{\WTSATC}{A 3CNF formula $\varphi$, a partial assignment $\alpha$ and a natural number $k$.}{Is there a satisfying assignment extending $\alpha$ that only sets $k$ more variables to true?}
yields something like
Problem, however, is that the size of this table changes every time, depending on its contents. I essentially want the font to be the same size as the rest of the main text in my document, and the widht of the table to always be fixed, without it filling the entire text column. Any ideas how to fix it?
Best Answer
First off, you don't want
\resizebox
and quite likely you don't wanttable
either.Here's another version, with a different syntax, that can accommodate different types of problems with more than two items. I added an accent in “Question” just to show it works.