여러 페이지로 분할된 들여쓰기 상자

여러 페이지로 분할된 들여쓰기 상자

연습과 수정이 포함된 문서를 작성하고 있습니다. 나는 어떤 학생도 우연히 그것을 읽고 그 내용을 망치는 일이 없도록 수정 사항이 쉽게 눈에 띄기를 바랍니다. 이에 대한 환경을 작성했는데 문제는 여러 페이지로 분할되지 않는다는 것입니다./

\newenvironment{solution}%
{\par\rule{1ex}{1ex}
\hspace{\stretch{1}}
\textbf{Solution}
\hspace{\stretch{1}}
\rule{1ex}{1ex}\par%
\hspace{2ex}% indent everything by 2ex
%\begin{myindentpar}{7ex}
%\quote \quote
\begin{minipage}{0.95\linewidth}% stop just before the right squares
\begin{framed}}% put a black frame
%\addtolength{\leftskip}{4cm}
%\begin{adjustwidth}{6cm}{}
%\begin{longtable}{|p{1.1\linewidth}|}
%\hline}
{\end{framed}\end{minipage}
%{\\\hline\end{longtable}
%\end{adjustwidth}
%\end{myindentpar}
%\endquote \endquote
\par
\rule{1ex}{1ex}\hspace{\stretch{1}}
\hspace{\stretch{1}}\rule{1ex}{1ex}\par}

나는 그것이 당신에게 영감을 줄 수 있도록 의도적으로 내 의견을 남겨 두었습니다.

디자인을 조금 바꾸는 솔루션을 찾으신다면 여전히 많은 관심을 받고 있습니다 :)

답변1

코드의 문제는 mdframed내부를 a로 묶었 minipageminipage페이지 나누기를 허용하지 않는다는 것입니다. 내 생각 minipage엔 프레임 모서리에 있는 작은 사각형을 찾기 위해 를 사용한 것 같습니다 . 그러나 이는 필요하지 않으며 환경 내에서 페이지 나누기 가능성을 손상시키지 않고 , singleextra를 사용하여 찾을 수 있습니다.firstextra

두 가지 스타일을 정의한 작은 예: 첫 번째 스타일은 정사각형이 없고 두 번째 스타일은 정사각형을 사용합니다(사용하려는 정확한 길이는 확실하지 않지만 필요한 조정을 쉽게 할 수 있습니다).

\documentclass{article}
\usepackage[a5paper]{geometry}% just for the example
\usepackage[framemethod=tikz]{mdframed}
\usepackage{tikzpagenodes}
\usepackage{lipsum}% just to generate text for the example
\usetikzlibrary{calc}

\mdfdefinestyle{mystyle}{%
  leftmargin=2ex,
  innertopmargin=2\baselineskip,
  skipabove={\dimexpr0.5\baselineskip+\topskip\relax},
  skipbelow={\dimexpr0.5\baselineskip+\topskip\relax},
  firstextra={%
    \path let \p1=(P), \p2=(O) 
    in node[font=\bfseries] at ([yshift=-2ex]0.5*\x1-\x2,\y1) {Solution};
  }
}
\mdfdefinestyle{mysquare}{%
  leftmargin=0pt,
  rightmargin={\dimexpr4pt+2ex\relax},
  innertopmargin=2\baselineskip,
  skipabove={\dimexpr0.5\baselineskip+\topskip\relax},
  skipbelow={\dimexpr0.5\baselineskip+\topskip\relax},
  singleextra={%
  \path let \p1=(P), \p2=(O) 
    in node[font=\bfseries] at ([yshift=-2ex]0.5*\x1-\x2,\y1) {Solution};
  \fill[black] ([xshift=2pt,yshift=2pt]P) rectangle ++(1ex,1ex);
  \fill[black] ([xshift=-2pt,yshift=-2pt]O) rectangle ++(-1ex,-1ex);
  \fill[black] ([xshift=-2pt,yshift=2pt]O|-P) rectangle ++(-1ex,1ex);
  \fill[black] ([xshift=2pt,yshift=-2pt]O-|P) rectangle ++(1ex,-1ex);
  },
  firstextra={%
  \path let \p1=(P), \p2=(O) 
    in node[font=\bfseries] at ([yshift=-2ex]0.5*\x1-\x2,\y1) {Solution};
  \fill[fill=black] ([xshift=2pt,yshift=2pt]P) rectangle ++(1ex,1ex); 
  \fill[black] ([xshift=-2pt,yshift=2pt]O|-P) rectangle ++(-1ex,1ex);
  },
  secondextra={%
  \fill[fill=black] ([xshift=2pt,yshift=-2pt]O-|P) rectangle ++(1ex,-1ex); 
  \fill[black] ([xshift=-2pt,yshift=-2pt]O) rectangle ++(-1ex,-1ex);
  }
}
\newmdenv[style=mystyle]{solution}
\newmdenv[style=mysquare]{ssolution}

\begin{document}

\lipsum[1]
\begin{solution}
\lipsum[2-3]
\end{solution}
\lipsum[2]
\begin{ssolution}
\lipsum[1-2]
\end{ssolution}
\lipsum[2]

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보