So I'm trying to make a worksheet template for students to create pdfs for student markup. The inputs create what is going to go in the question box as well as the hints box.
I want to create the height for these two boxes dynamically - that is I want them to be the same and to scale based on the inputs. The Answer box should take up the remaining space on the page. I'm having a few issues:
I currently am having the Question box height based on the input, and scaling the Hint box to match. I'd like to have them be the bigger of the two.
I currently cannot get the resulting image to center on the page.
I'm really not sure that I am doing this the most efficient way, but I'm open to suggestions. I'd like to automate the process to make it easy to produce content for my students.
Thanks in advance for your time and effort.
\documentclass{article}
\pagestyle{empty}
\usepackage[top=.5in, left=.5in, right=.5in, bottom=.5in]{geometry}
\usepackage{tikz}
\usepackage{calc}
\usetikzlibrary{arrows, positioning, calc, fit}
\newcommand\WS[2]{
\begin{tikzpicture}
% The Question
\node[
draw=red,
fill=red!10,
rounded corners=6pt,
text width=.55\textwidth,
minimum height=.1\textheight,
inner sep=20pt,
align=center]
(Question)
{
#1
};
% The Label
\node[
draw=red,
fill=red!30,
rounded corners=6pt,
anchor=north west,
inner sep=5pt]
at (Question.north west)
{
Question
};
% The Hints
\path let
\p1=($(Question.south)-(Question.north)$),
\n1 = {veclen(\p1)-0.4pt} % 0.4pt is the width of the border line
in
node[
draw=blue,
fill=blue!10,
rounded corners=6pt,
text width=.35\textwidth,
minimum height=\n1,
right=0pt of Question.north east,
anchor=north west,
align=center,
inner sep=5pt]
(Hint)
{
#2
};
% The Label
\node[
draw=blue,
fill=blue!30,
rounded corners=6pt,
anchor=north west,
inner sep=5pt]
at (Hint.north west)
{
Hint
};
% Space to Answer
\path let
\p2 = ($(Question.west)-(Hint.east)$),
\n2 = {veclen(\p2)-0.4pt}, % 0.4pt is the width of the border
% line
\p3 = ($(Question.north)-(Question.south)$),
\n3 = {\textheight-veclen(\p3)-10.4pt}
in
node[
draw=green,
fill=green!10,
rounded corners=6pt,
text height=\n3,
below=0pt of Question.south west,
anchor=north west,
minimum width=\n2]
(Answer)
{
};
% The Label
\node[
draw=green,
fill=green!30,
rounded corners=6pt,
anchor=north west,
inner sep=5pt]
at (Answer.north west)
{
Answer
};
\end{tikzpicture}
}
\begin{document}
\WS{
Suppose you have a right triangle as presented below. Let $a=2$ cm, and
$b=3$ cm. How long would $c$ be?
\par
\begin{tikzpicture}
\draw[rounded corners=0pt] (0,0) -- (2,0) -- (2,3) -- (0,0);
\end{tikzpicture}
\par
Remember to leave your answers as a square root, and to show all work and
leave units.
}
{
\begin{itemize}
\item Think about the pythagorean formula.
\item It involves squares.
\item And adding.
\end{itemize}
}
\end{document}



\noindentbefore\WSor the inner\begin{tikzpicture}. – Qrrbrbirlbel Dec 10 '12 at 20:29