1

So that I have a better idea of my students' names I would like to generate schematic plans of the classrooms I teach in so that the students can tick off where they are sitting. Using some ideas from here I have come up with the seating grid with aisles greyed out (see below).

I would now like to make it proportional to the rooms dimensions to make it a bit more realistic. For example, if the classroom dimensions are 6m x 12m and the open area at the top of the room is 4m then I would like to scale my seating matrix to fit into the 6m x 8m area within a drawn rectangle of 6m x 12m.

I would be very grateful for any help with this. I can then decorate the room outline with teacher's desk, podium, doors, etc.

Many thanks, Patrick Healy

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\tikzset{myset/.style args = {(#1,#2)}{%
    row #1 column #2/.style={nodes={circle,fill=gray}}}}
\begin{tikzpicture}[myset/.list={(1,3),(1,4),(2,3),(2,4),(3,3),(3,4),
    (4,3),(4,4),(5,3),(5,4),(6,3),(6,4),(7,3),(7,4),
    (8,3),(8,4),(8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8)}]
\matrix [matrix of nodes, column sep=1mm, row sep=1mm, nodes={circle,draw}]
{
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\ 
  };
\end{tikzpicture}
\end{document}
1

Maybe this scalerel/stackengine approach can be made to work for you. Here, I scale the tikzpicture (stored in temporary \box0) to 8cm (7.5 cm actually) and use \stackinset to place it and other stuff (\desk, \board, & \lectern) in the 6cm x 12cm \room.

\documentclass{standalone}
\usepackage{tikz,scalerel,stackengine}
\setstackgap{S}{0pt}
\usetikzlibrary{matrix}
\setlength\unitlength{1cm}
\begin{document}
\tikzset{myset/.style args = {(#1,#2)}{%
    row #1 column #2/.style={nodes={circle,fill=gray}}}}%
\setbox0=\hbox{\begin{tikzpicture}[myset/.list={(1,3),(1,4),(2,3),(2,4),(3,3),(3,4),
    (4,3),(4,4),(5,3),(5,4),(6,3),(6,4),(7,3),(7,4),
    (8,3),(8,4),(8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8)}]
\matrix [matrix of nodes, column sep=1mm, row sep=1mm, nodes={circle,draw}]
{
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\
  {}& {}& {}& {}& {}& {}& {}& {}\\ 
  };
\end{tikzpicture}}%
\savestack\studentdesks{\scaleto{\copy0}{7.5cm}}
\def\room{\rule{6cm}{0pt}\rule{0pt}{12cm}}%
\def\desk{\framebox(2.5,1.5){desk}}%
\def\lectern{\framebox(1,1){\tiny podium}}%
\def\board{\framebox(4,.2){\tiny board}}%
%
\stackinset{c}{}{t}{}{\board}{%
\stackinset{r}{.5cm}{t}{2.5cm}{\lectern}{%
\stackinset{l}{.5cm}{t}{1cm}{\desk}{%
\stackinset{c}{}{b}{}{\studentdesks}{%
  \room}}}}%
\end{document}

enter image description here

  • Very helpful. Thanks a lot. I presume that instead of nesting several \stackinsets I could map out the top of the classroom in a second tikzpicture and then simply stack those two pictures, right? – healyp Aug 29 '17 at 11:28
  • @healyp I presume "yes", but I am not a tikz user myself. – Steven B. Segletes Aug 29 '17 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.