단락 사이에 tikzpicture를 멋지게 넣는 방법은 무엇입니까?

단락 사이에 tikzpicture를 멋지게 넣는 방법은 무엇입니까?

단락 사이에 tikzpicture를 멋지게 넣고 싶습니다. 어떻게 해야 하나요? 아래에 여분의 공간이 있기 때문에 사진 환경에 놓고 싶지 않습니다.

\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
%\printanswers
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}

\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}

\begin{document}
\begin{questions}


Line above tikzpicture.

\begin{tikzpicture}[rounded corners=5mm]
\path node[rectangle,draw=green,fill=green!8,inner sep=.70cm] {\parbox{\textwidth-1.4cm-\fboxrule}{

\question[2] What is the first question?
\begin{solutionorlines}[4cm]
This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?
\end{solutionorlines}
}};
\end{tikzpicture}

Line under tikzpicture. I don't want this. I want the tikzpicture between paragraphs.

\end{questions}
\end{document}

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

답변1

색상이 있는 상자를 그리는 것은 tcolorbox솔루션을 제공하기 위한 나의 표어입니다. 정확한 공백 크기는 before skip및 으로 설정할 수 있습니다 after skip. 동일하게 하기를 원하므로 를 사용할 수도 있습니다 beforeafter skip. 저는 아래 두 개의 상자를 사용합니다. 첫 번째 상자는 일반 상자이고, 두 번째 상자는 거리 설정을 표시하기 위한 것입니다.

\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
%\printanswers
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}
\usepackage{tcolorbox}

\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}

\newtcolorbox{greenbox}[1][]{%
  size=fbox,
  arc=5mm,
  boxsep=0.7cm,
  %boxsep=\fboxsep,% uncommented to use \fboxsep
  colframe=green,
  colback=green!8,
  beforeafter skip=3mm,% <--- Space setting before and after
  #1%
}

\begin{document}

\begin{questions}

Line above tikzpicture.

\begin{greenbox}
  \question[2] What is the first question?
  \begin{solutionorlines}[4cm]
  This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?
  \end{solutionorlines}
\end{greenbox}

Line under tikzpicture. I don't want this. I want the tikzpicture between paragraphs.

Line above tikzpicture.

\begin{greenbox}[beforeafter skip=0mm]
  \question[2] What is the first question?
  \begin{solutionorlines}[4cm]
  This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?
  \end{solutionorlines}
\end{greenbox}

Line under tikzpicture. I don't want this. I want the tikzpicture between paragraphs.

\end{questions}

\end{document}

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

답변2

수업 은 모르지만 내부 환경에서는 모든 문단이 다르게 취급되는 exam것 같습니다 . questions단락 구분을 추가하지 않고도 개행을 추가할 수 있습니다.

\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
%\printanswers
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}

\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}

\begin{document}
\begin{questions}

Line above tikzpicture.\\[1em]
\begin{tikzpicture}[rounded corners=5mm]
\path node[rectangle,draw=green,fill=green!8,inner sep=.70cm] {
  \parbox{\textwidth-1.4cm-\fboxrule}{
    \question[2] What is the first question?
    \begin{solutionorlines}[4cm]
    This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?
    \end{solutionorlines}
  }};
\end{tikzpicture}\\[1em]
Line under tikzpicture. I don't want this. I want the tikzpicture between paragraphs.

\end{questions}
\end{document}

메모:mdframed질문을 프레임에 넣으려면 패키지를 확인하세요 .

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

답변3

간격이 약간 어긋나고 답변 너비가 너무 크기 때문에 이는 완전한 솔루션이 아닙니다. 최종 조정을 할 시간이 없습니다. 다른 사람들은 이 답변을 편집하거나 시작점으로 사용할 수 있습니다.

\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
\printanswers % or commented out for lines
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}

\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}

\begin{document}
\begin{questions}

\question[2] What is the first question?
\begin{solutionorlines}[4cm]
\begin{minipage}[t][4cm]{\textwidth}This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?\end{minipage}
\end{solutionorlines}
\question[2] What is the second question?
\begin{solutionorlines}[4cm]
\begin{minipage}[t][4cm]{\textwidth} This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?\end{minipage}
\end{solutionorlines}

\end{questions}
\end{document}

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

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

관련 정보