1

enter image description here

I am using LaTeX to make a presentation slide and am wanting to make a slide that shows students who are at a certain level. Basically I want to fill the slide with person symbols as below; and I want to enter the number of rows/columns of blue people and the number of both blue and red people. Please help me! I am not even sure of where to start.

i want the people to fill the slide completely instead of something like this:

enter image description here

bvowe
  • 171

1 Answers1

4

Here is a proposal using the code from this nice answer. You can set the number of blue persons.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\begin{document}
\begin{frame}[t,fragile]
\frametitle{People}
\begin{tikzpicture}[pics/person/.style={code={%https://tex.stackexchange.com/a/84566/121799
\node[circle,fill,minimum size=5mm] (head) {};
\node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {};
\draw[line width=1mm,Round Cap-Round Cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm);
\draw[line width=1mm,Round Cap-Round Cap] ([shift={(-2pt,-1pt)}]body.north west)--++(-90:6mm);
\draw[thick,white,-Round Cap] (body.south) --++(90:5.5mm);}}]
 \pgfmathsetmacro{\Zblue}{25}
 \path foreach \X in {0,...,9}
  {foreach \Y [evaluate=\Y as \Z using {int(\X-10*\Y)}] in {0,-1,-2,-3}
  {\ifnum\Z<\Zblue
  (\X,2*\Y) pic[blue]{person}
  \else
  (\X,2*\Y) pic[red]{person}
  \fi}};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

Of course you could also specify the number of blue persons per line. These numbers are specified in \LstBlue.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\begin{document}
\begin{frame}[t,fragile]
\frametitle{People}
\begin{tikzpicture}[pics/person/.style={code={%https://tex.stackexchange.com/a/84566/121799
\node[circle,fill,minimum size=5mm] (head) {};
\node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {};
\draw[line width=1mm,Round Cap-Round Cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm);
\draw[line width=1mm,Round Cap-Round Cap] ([shift={(-2pt,-1pt)}]body.north west)--++(-90:6mm);
\draw[thick,white,-Round Cap] (body.south) --++(90:5.5mm);}}]
 \def\LstBlue{8,7,5,1}
 \path  foreach \Y [evaluate=\Y as \Z using {{\LstBlue}[\Y]}] in {0,...,3}
  {foreach \X in {0,...,9}
  {\ifnum\X<\Z
  (\X,-2*\Y) pic[blue]{person}
  \else
  (\X,-2*\Y) pic[red]{person}
  \fi
  }};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

Here is a version with 100 people.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\begin{document}
\begin{frame}[t,fragile]
\frametitle{People}
\hfill\begin{tikzpicture}[pics/person/.style={code={%https://tex.stackexchange.com/a/84566/121799
\node[circle,fill,minimum size=5mm] (head) {};
\node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {};
\draw[line width=1mm,Round Cap-Round Cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm);
\draw[line width=1mm,Round Cap-Round Cap] ([shift={(-2pt,-1pt)}]body.north west)--++(-90:6mm);
\draw[thick,white,-Round Cap] (body.south) --++(90:5.5mm);}},
xscale=0.7,yscale=0.4,transform shape] %<- scale down
 \pgfmathsetmacro{\Zblue}{55}
 \path foreach \X in {0,...,9}
  {foreach \Y [evaluate=\Y as \Z using {int(\X+10*\Y)}] in {0,...,9}
  {\ifnum\Z<\Zblue
  (1.6*\X,-2*\Y) pic[blue]{person}
  \else
  (1.6*\X,-2*\Y) pic[red]{person}
  \fi}};
\end{tikzpicture}\hfill\null
\end{frame}
\end{document}

enter image description here

  • thanks so much! this makes 40 people but i can't figure out how to make 100 and fit them all to a plain slide!? – bvowe Jun 05 '19 at 03:56
  • @bvowe This is easy. Which version will you use, the upper or lower one? One only needs to scale these guys down. –  Jun 05 '19 at 03:57
  • the exact code you shared is perfect. now i just want to fit 100 to the full slide and center if needed, but fit them all 100 to the full slide – bvowe Jun 05 '19 at 03:59
  • @bvowe I added a version at the bottom. –  Jun 05 '19 at 04:02
  • sorry to be annoying but how do i fit it 10x10 so it fits to the slide evenly – bvowe Jun 05 '19 at 04:04
  • @bvowe Now there are 10x10 people. –  Jun 05 '19 at 04:07
  • this is so great you're amazing...but they still don't fill the screen. see please updated questions since i don't know where else to post photo. – bvowe Jun 05 '19 at 04:24
  • @bvowe Well, you want 10x10 and have objects which have a smaller horizontal dimension than vertical dimension and want to fill completely some slide that is wider than high. Do you want to (a) deform the persons or (b) have large horizontal gaps between them? –  Jun 05 '19 at 04:39