0

I want to reproduce this output from the book Parameterized Complexity Theory by Flum and Grohe: enter image description here

I try using a minipage, and an fbox. However, the text overflows the box, and linebreaks do not work:

enter image description here

Here is the MWE:

\documentclass[10pt]{article}
\usepackage{parskip,multicol,amsmath,amsfonts}

\newcommand{\defPP}[4] 
{
    \fbox
    {   
        \begin{minipage}{\textwidth}

            #1

            \begin{tabular}{r l}


                \textit{Instance:}& #2\\    
                \textit{Parameter:}& #3\\
                \textit{Problem:}& #4   
            \end{tabular}

        \end{minipage}
    }

}

\begin{document}
    \defPP{\emph{p}-\textsc{Bounded-NTM-Halt}}{A deterministic TM $\mathbb{M}$, $n \in \mathbb{N}$ in unary, $k \in mathbb{N}$}{$k$}{Decide whether $\mathbb{M}$ accepts the empty string at most in $n$ steps and using at most $k$ nondeterministic steps.}

    To show that $p$-\textsc{Bounded-NTM-Halt} $\in \text{W[P]}$, [...]
\end{document}
padawan
  • 1,532

2 Answers2

1

I think the answer you're looking for is to use a p type column as in this answer.

Thus, substitute something like \begin{tabular}{r p{9cm}} where you currently have \begin{tabular}{r l}.

AML
  • 2,265
1

Here is a more automated approach using tcolorbox for the box and tabularx's flexible width X column for the second column.

The first box occupies the whole textwidth, while the contents in the second column are automatically wrapped to fit into the box depending on the width of the first column.

The second alternative only uses part of the textwidth (using the width= option and is horizontally centered using the center environment.

\documentclass[10pt]{article}
\usepackage{parskip,multicol,amsmath,amsfonts}
\usepackage{tabularx}
\usepackage{tcolorbox}

\newcommand{\defPPone}[4] 
{
   \begin{tcolorbox}[sharp corners, colframe=black, colback=white, boxrule=0.75pt]
      \begin{tabularx}{\linewidth}{@{}r X@{}}
         \multicolumn{2}{p{\linewidth}}{#1}\\
         \textit{Instance:}& #2\\    
         \textit{Parameter:}& #3\\
         \textit{Problem:}& #4   
       \end{tabularx}
    \end{tcolorbox}
}

\newcommand{\defPPtwo}[4] 
{
   \begin{center}
   \begin{tcolorbox}[sharp corners, colframe=black, colback=white, boxrule=0.75pt,width=0.75\textwidth]
      \begin{tabularx}{\linewidth}{@{}r X@{}}
         \multicolumn{2}{p{\linewidth}}{#1}\\
         \textit{Instance:}& #2\\    
         \textit{Parameter:}& #3\\
         \textit{Problem:}& #4   
       \end{tabularx}
    \end{tcolorbox}
    \end{center}
}

\begin{document}


\defPPone{\emph{p}-\textsc{Bounded-NTM-Halt}}{A deterministic TM $\mathbb{M}$, $n \in \mathbb{N}$ in unary, $k \in \mathbb{N}$}{$k$}{Decide whether $\mathbb{M}$ accepts the empty string at most in $n$ steps and using at most $k$ nondeterministic steps.}

To show that $p$-\textsc{Bounded-NTM-Halt} $\in \text{W[P]}$, [...]

\defPPtwo{\emph{p}-\textsc{Bounded-NTM-Halt}}{A deterministic TM $\mathbb{M}$, $n \in \mathbb{N}$ in unary, $k \in \mathbb{N}$}{$k$}{Decide whether $\mathbb{M}$ accepts the empty string at most in $n$ steps and using at most $k$ nondeterministic steps.}

To show that $p$-\textsc{Bounded-NTM-Halt} $\in \text{W[P]}$, [...]

\end{document}

enter image description here

leandriis
  • 62,593