带有人物符号的 LaTeX 投影仪幻灯片

带有人物符号的 LaTeX 投影仪幻灯片

在此处输入图片描述

我正在使用 LaTeX 制作演示文稿幻灯片,并希望制作一张展示处于特定水平的学生的幻灯片。基本上,我想用下面的人物符号填充幻灯片;我想输入蓝色人的行数/列数以及蓝色和红色人的数量。请帮帮我!我甚至不知道从哪里开始。

我希望人们把幻灯片完全填满,而不是像这样:

在此处输入图片描述

答案1

以下是使用以下代码的提案这个很好的答案.可以设定蓝色人数。

\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}

在此处输入图片描述

当然你也可以指定每行蓝色人物的数量。这些数字在 中指定\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}

在此处输入图片描述

这是一个有 100 人的版本。

\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}

在此处输入图片描述

相关内容