编译后的 PDF 中显示有破损的盒子

编译后的 PDF 中显示有破损的盒子

编译后的 PDF 中显示损坏的框。请参阅下面的 LaTeX 代码:

\documentclass{article}
\usepackage{graphicx}
\usepackage{a4wide}

\usepackage{tabularx} 

\makeatletter
\newenvironment{problem}[2][]{%
  \def\problem@arg{#1}%
  \def\problem@framed{framed}%
  \def\problem@lined{lined}%
  \def\problem@doublelined{doublelined}%
  \ifx\problem@arg\@empty%
    \def\problem@hline{}%
  \else%
    \ifx\problem@arg\problem@doublelined%
      \def\problem@hline{\hline\hline}%
    \else%
      \def\problem@hline{\hline}%
    \fi%
  \fi%
  \ifx\problem@arg\problem@framed%
    \def\problem@table{\tabularx{\textwidth}{|>{\bfseries}lX|c}}%
    \def\problem@title{\multicolumn{2}{|l|}{%
        \raisebox{-\fboxsep}{\textsc{\Large #2}}%
      }}%
  \else
    \def\problem@table{\tabularx{\textwidth}{>{\bfseries}lXc}}%
    \def\problem@title{\multicolumn{2}{l}{%
        \raisebox{-\fboxsep}{\textsc{\Large #2}}%
      }}%
  \fi%
  \bigskip\par\noindent%
  \renewcommand{\arraystretch}{1.2}%
    \problem@table%
      \problem@hline%
      \problem@title\\[2\fboxsep]%
}{%
      \\\problem@hline%
    \endtabularx%
  \medskip\par%
}
\makeatother


\section{Introduction}

Given  two graphs $G =(V,E_1)$ and $H = (V,E_2)$  are said to be isomorphic if there exists a bijection $\phi: V \mapsto V$ that preserves the edges and non-edges. Similarliy two groups $(G,\circ)$ and $(H,\times )$ are said to be isomorphic if there exist an bijective map from $\pi : G \mapsto H$ such that $\forall a,b \in G, \pi(a\circ b) = \pi(a) \times \pi(b)$.
Graph isomorphism is strongly related to group theoretic problems like group isomorphism, group intersection etc. Grpah Isomorphism is known to be in $\mathsf{NP}$, not known to be in $\mathsf{P}$ and very unlikely to be $\mathsf{NP}$-complete.

\begin{problem}[framed]{Graph Isomorphism (GI)}
  Inpu: & Two graphs $G=(V,E_1)$ and $H=(V,E_2)$. \\
  Problem: & Is $G$ isomorphic to $H$? \\

\end{problem}
\end{document}

在此处输入图片描述

答案1

请不要a4wide再使用这个包!查看卡坦

要摆脱损坏的盒子,您必须删除/注释掉以下 MWE 中\\标记的 I :<=====

\documentclass{article}

%\usepackage{a4wide} % <=========================== use package geometry
\usepackage[a4paper]{geometry}
\usepackage{graphicx}
\usepackage{tabularx}

\makeatletter
\newenvironment{problem}[2][]{%
  \def\problem@arg{#1}%
  \def\problem@framed{framed}%
  \def\problem@lined{lined}%
  \def\problem@doublelined{doublelined}%
  \ifx\problem@arg\@empty%
    \def\problem@hline{}%
  \else%
    \ifx\problem@arg\problem@doublelined%
      \def\problem@hline{\hline\hline}%
    \else%
      \def\problem@hline{\hline}%
    \fi%
  \fi%
  \ifx\problem@arg\problem@framed%
    \def\problem@table{\tabularx{\textwidth}{|>{\bfseries}lX|c}}%
    \def\problem@title{\multicolumn{2}{|l|}{%
        \raisebox{-\fboxsep}{\textsc{\Large #2}}%
      }}%
  \else
    \def\problem@table{\tabularx{\textwidth}{>{\bfseries}lXc}}%
    \def\problem@title{\multicolumn{2}{l}{%
        \raisebox{-\fboxsep}{\textsc{\Large #2}}%
      }}%
  \fi%
  \bigskip\par\noindent%
  \renewcommand{\arraystretch}{1.2}%
    \problem@table%
      \problem@hline%
      \problem@title\\[2\fboxsep]%
}{%
%     \\% <=============================================================
      \problem@hline%
    \endtabularx%
  \medskip\par%
}
\makeatother


\begin{document}

\section{Introduction}

Given  two graphs $G =(V,E_1)$ and $H = (V,E_2)$  are said to be 
isomorphic if there exists a bijection $\phi: V \mapsto V$ that 
preserves the edges and non-edges. Similarliy two groups $(G,\circ)$ and 
$(H,\times )$ are said to be isomorphic if there exist an bijective map 
from $\pi : G \mapsto H$ such that 
$\forall a,b \in G, \pi(a\circ b) = \pi(a) \times \pi(b)$.
Graph isomorphism is strongly related to group theoretic problems like 
group isomorphism, group intersection etc. Grpah Isomorphism is known 
to be in $\mathsf{NP}$, not known to be in $\mathsf{P}$ and very 
unlikely to be $\mathsf{NP}$-complete.

\begin{problem}[framed]{Graph Isomorphism (GI)}
  Input: & Two graphs $G=(V,E_1)$ and $H=(V,E_2)$. \\
  Problem: & Is $G$ isomorphic to $H$? \\

\end{problem}
\end{document}

您将获得结果:

在此处输入图片描述

相关内容