
Quero colocar minha imagem tikz bem entre os parágrafos. Como faço isso? Não quero colocá-lo em um ambiente fotográfico porque há espaço extra embaixo.
\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}
Responder1
Desenhar uma caixa colorida é meu lema para oferecer uma tcolorbox
solução. A dimensão exata do espaço em branco pode ser definida com before skip
e after skip
. Como você deseja que seja igual, você também pode usar beforeafter skip
. Utilizo duas caixas abaixo: A primeira é a normal, a segunda só para mostrar as configurações de distância.
\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}
Responder2
Não conheço a exam
turma, mas parece que dentro questions
do ambiente todos os parágrafos são tratados de forma diferente. Você pode adicionar nova linha sem adicionar quebra de parágrafo.
\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}
OBSERVAÇÃO:Você pode verificar mdframed
o pacote se quiser colocar perguntas em frames.
Responder3
Esta não é uma solução completa, pois o espaçamento está um pouco errado e a largura da resposta é muito grande. Não há tempo para fazer os ajustes finais. Outros podem editar esta resposta ou usá-la como ponto de partida:
\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}