%
%	gbb60166@gmail.com	https://unilab.gbb60166.jp/prekou/prekou.htm
%
% aspectratio= は 1610, 169, 149, 54, 32 の中から選べる（省略時は 43）
% C:\texlive\2023\texmf-dist\tex\latex\beamer\beamer.cls
%\documentclass[20pt,dvipdfmx,usepdftitle=false,hyperref={pdfpagemode=FullScreen},aspectratio=169]{beamer}
%\documentclass[20pt,dvipdfmx,usepdftitle=false,hyperref={pdfstartview={XYZ null null 8.00}},aspectratio=169]{beamer}
\documentclass[20pt,dvipdfmx,usepdftitle=false,aspectratio=169]{beamer}
% pdfの栞の字化けを防ぐ
%\AtBeginDvi{\special{pdf:tounicode EUC-UCS2}}
% テーマ
\usetheme{Copenhagen}
% navi. symbolsは目立たないが，dvipdfmxを使うと機能しないので非表示に
\setbeamertemplate{navigation symbols}{} 
\usepackage{bxdpx-beamer,pxjahyper,minijs}
%\usepackage{graphicx}
%\usepackage{tkokugo,furikana,tsayusen,shiika,sfkanbun,jdkintou,plext}
\usepackage{type1cm}
\usepackage[deluxe]{otf}
%\usepackage{tikzsymbols}
%\usepackage[dvipdfmx]{graphicx}%
\def\pgfsysdriver{pgfsys-dvipdfmx.def}%（graphicxパッケージを使用しない場合はこの行を有効に）
%\def\pgfsysdriver{pgfsys-dvips.def}%デフォルト
%\usepackage[e]{esvect}
\usepackage{tikz}%（これで、pgfとpgfforが読み込まれます。）
%\usepackage{tikz-3dplot}
%\usetikzlibrary{calc}
%\usetikzlibrary{arrows.meta,patterns,angles,intersections,backgrounds}
%\usepackage{animate}
%\usepackage{pgfplots}
%\pgfplotsset{compat=newest}
%\pgfplotsset{compat=newest, every axis/.append style={line width=1pt}}
%\PassOptionsToPackage{dvipdfmx}{graphicx}
\nofiles

\hypersetup{% Jul 18 2023
	pdftitle={プレ高数学科（LaTeX Beamer で汎用PDFプレゼンを作る）},
	pdfauthor={gbb60166@gmail.com},
	pdfsubject={https://unilab.gbb60166.jp/prekou/prekou.htm}
	}

% フォントはお好みで
%\usepackage{txfonts}

\mathversion{bold}
\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\seriesdefault}{bx}
\renewcommand{\kanjifamilydefault}{\gtdefault}
\renewcommand{\kanjiseriesdefault}{bx}
\setbeamerfont{title}{size=\normalsize,series=\bfseries}
\setbeamerfont{frametitle}{size=\normalsize,series=\bfseries}
\setbeamertemplate{frametitle}[default][center]
\usefonttheme{professionalfonts}

% 参考にしたURL
% http://windom.phys.hirosaki-u.ac.jp/fswiki/wiki.cgi?page=LaTeX+Beamer%A4%C7%A5%D7%A5%EC%A5%BC%A5%F3%A5%C6%A1%BC%A5%B7%A5%E7%A5%F3

\newcommand{\Slash}[1]{\ooalign{\hfil\kern-3pt／\hfil\crcr$#1$}}
\everymath{\displaystyle}

\newcommand{\maruwaku}[1]{\begin{tikzpicture}[scale=0.7, baseline={([yshift=-22pt] current bounding box.north)}]
\filldraw[color=CUDBlue, line width=1pt, rounded corners=2pt] (-0.1,0)--(2.1,0)--(2.1,1.1)--(-0.1,1.1)--cycle;
\draw(1,0.5) node[white]{#1};
\end{tikzpicture}
}

\setbeamersize{text margin left=3mm,text margin right=3mm}
\fboxrule=0.8pt

\makeatletter
\newcommand{\hooklen}[2]{\settowidth{\@tempdima}{\(#1\)}
%\advance\@tempdima by.3ex
% ↑ 数式モードで式の前後に入るスペースを制御したかったが、
%    難しいのでやめた。段々難解なコードになっているのでやめた方がよい？
\hbox to\@tempdima{\hfil \(#2\)\hfil}}
%■等号付き不等号 by 美文書作成入門
\newcommand{\myleqq}{\mathrel{\mathpalette\gl@align<}}
\newcommand{\mygeqq}{\mathrel{\mathpalette\gl@align>}}
\newcommand{\gl@align}[2]{\lower.6ex\vbox{\baselineskip\z@skip\lineskip\z@
	\ialign{$\m@th#1\hfil##\hfil$\crcr#2\crcr=\crcr}}}
\makeatother

% カラーユニバーサルデザインを調べたつもりだがあまり自信がありません
% http://www.fukushihoken.metro.tokyo.jp/kiban/machizukuri/kanren/color.files/colorudguideline.pdf
% http://jfly.iam.u-tokyo.ac.jp/colorset/

% ■ アクセントカラー小面積を目立たせる高彩度色
\definecolor{CUDRed}{RGB}{255,75,0}
\definecolor{CUDGreen}{RGB}{3,175,122}
\definecolor{CUDBlue}{RGB}{0,90,255}
\definecolor{CUDCyan}{RGB}{77,196,255}
\definecolor{CUDMagenta}{RGB}{153,0,153}
\definecolor{CUDYellow}{RGB}{255,241,0}
\definecolor{CUDBrown}{RGB}{128,64,0}

\definecolor{CUDOrange}{RGB}{246,170,0}

% ■ ベースカラー広い面積の塗り分けに用いる低・中彩度色
\definecolor{CUDPink}{RGB}{255,202,191}
\definecolor{CUDBrightGreen}{RGB}{119,217,168}
\definecolor{CUDLime}{RGB}{216,242,85}
\definecolor{CUDCream}{RGB}{255,255,128}
\definecolor{CUDBrightCyan}{RGB}{191,228,255}
%\definecolor{CUD}{RGB}{}%

\setbeamercolor{CUDBrightGreen}{fg=black,bg=CUDBrightGreen!50}
\setbeamercolor{CUDBrightCyan}{fg=black,bg=CUDBrightCyan}
\setbeamercolor{CUDCream}{fg=black,bg=CUDCream!75}


\begin{document}

\title{プレ高数学科}\author{gbb60166}

\newcommand{\gbbi}{\fbox{\shortstack{男\\[-3pt]Ａ}}}
\newcommand{\gbbii}{\fbox{\shortstack{男\\[-3pt]Ｂ}}}
\newcommand{\gbbiii}{\fbox{\shortstack{男\\[-3pt]Ｃ}}}
\newcommand{\gbbiv}{\fbox{\shortstack{男\\[-3pt]Ｄ}}}
\newcommand{\gbbv}{\fbox{\shortstack{男\\[-3pt]Ｅ}}}
\newcommand{\gbbvi}{\fbox{\shortstack{女\\[-3pt]Ａ}}}
\newcommand{\gbbvii}{\fbox{\shortstack{女\\[-3pt]Ｂ}}}

\newcommand{\ittan}{\begin{tikzpicture}[scale=0.7,
	baseline={([yshift=-16pt] current bounding box.north)}]
\filldraw[very thick,draw=CUDBlue,fill=CUDYellow,rounded corners=1pt]
	(0,0)--++(0.8,0)--++(0,0.8)--++(-0.8,0)--cycle;
\draw(0.4,0.4) node[CUDBlue]
	{\fontsize{7pt}{7pt}\selectfont
		\shortstack{一旦\\[-2pt]停止}};
\end{tikzpicture}
}

%■■■■■■■■■■■■■　テスト領域　■■■■■■■■■■■■■■




%\end{document}
%■■■■■■■■■■■■■　完成品　■■■■■■■■■■■■■■

\begin{frame}[t]
\frametitle{男子$5$人、女子$2$人が並ぶとき\ \#$7$ \ajKaku{2}}
女子$2$人が\textcolor{CUDOrange}{隣り合わない}並び方は何通り？\pause

\bigskip
逆から考える。つまり

\vskip-1zh
\[ \text{\textcolor{CUDRed}{すべての並び方}}\ - \ 
	\text{\textcolor{CUDBlue}{女子$2$人が隣り合う並び方}} \]

で求める。
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}[t]
\frametitle{すべての並び方は}
\vspace*{-2ex}
\hspace*{-12pt}
\begin{minipage}[t]{0.5\textwidth}
\invisible<3->{\gbbi}\,%
\invisible<7->{\gbbii}\,%
\invisible<15->{\gbbiii}\,%
\invisible<9->{\gbbiv}\,%
\invisible<13->{\gbbv}\,%
\invisible<11->{\gbbvi}\,%
\invisible<5->{\gbbvii}%
\end{minipage}
\begin{tikzpicture}[scale=0.7, >=stealth, inner sep=0pt,
	baseline=(current bounding box.north)]
%\draw[help lines] (-0.1,-5) grid (10.6,3);
\useasboundingbox (-0.1,-5) grid (10.6,3);

\foreach \i in {0,...,6}\draw(1.5*\i,0) rectangle ++(1.5,2.4);

\visible<3->{\draw(0.75,1.2) node{\gbbi};}
\visible<5->{\draw(2.25,1.2) node{\gbbvii};}
\visible<7->{\draw(3.75,1.2) node{\gbbii};}
\visible<9->{\draw(5.25,1.2) node{\gbbiv};}
\visible<11->{\draw(6.75,1.2) node{\gbbvi};}
\visible<13->{\draw(8.25,1.2) node{\gbbv};}
\visible<15->{\draw(9.75,1.2) node{\gbbiii};}

\color{CUDRed}
\only<16->{\foreach \i in {1,...,6}\draw(1.5*\i,-1) node{\small\(\times\)};}

\visible<2->{\draw(0.75,-1) node{$7$};}
\visible<4->{\draw(2.25,-1) node{$6$};}
\visible<6->{\draw(3.75,-1) node{$5$};}
\visible<8->{\draw(5.25,-1) node{$4$};}
\visible<10->{\draw(6.75,-1) node{$3$};}
\visible<12->{\draw(8.25,-1) node{$2$};}
\visible<14->{\draw(9.75,-1) node{$1$};}

\visible<17->{\draw(5,-3) node{\( =5040 \)\text{通り\ \ittan}};}
\end{tikzpicture}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{frame}[t]
\frametitle{女子$2$人が隣り合う並び方は}
\vspace*{-2ex}
\hspace*{-12pt}
\begin{minipage}[t]{0.5\textwidth}
\invisible<10->{\gbbi}\,%
\invisible<8->{\gbbii}\,%
\invisible<4->{\gbbiii}\,%
\invisible<12->{\gbbiv}\,%
\invisible<14->{\gbbv}\,%
\invisible<6->{\alt<1>{\gbbvi\,%
\gbbvii}{\fbox{\shortstack{女女\\[-3pt]ＡＢ}}}}%

\vspace*{3ex}
\only<2->{\textcolor{CUDRed}{女子$2$人を$1$つにまとめて}
\quad \textcolor{CUDGreen}{\( (\ \times2\text{倍} \)になる \()\)}}
\end{minipage}
\begin{tikzpicture}[scale=0.7, >=stealth, inner sep=0pt,
	baseline=(current bounding box.north)]
%\draw[help lines] (-0.1,-5) grid (10.6,3);
\useasboundingbox (-0.1,-5) grid (10.6,3);

\foreach \i in {0,...,5}{\draw(1.75*\i,0) rectangle ++(1.75,2.4);}

\visible<4->{\draw(0.7,1.2) node{\gbbiii};}
\visible<6->{\draw(2.625,1.2) node{\fbox{\shortstack{女女\\[-3pt]ＡＢ}}};}
\visible<8->{\draw(4.55,1.2) node{\gbbii};}
\visible<10->{\draw(6.125,1.2) node{\gbbi};}
\visible<12->{\draw(7.875,1.2) node{\gbbiv};}
\visible<14->{\draw(9.625,1.2) node{\gbbv};}

\color{CUDBlue}
\only<15->{\foreach \i in {1,...,5}
	\draw(1.75*\i,-1) node{\small\( \times \)};}

\visible<3->{\draw(0.7,-1) node{$6$};}
\visible<5->{\draw(2.625,-1) node{$5$};}
\visible<7->{\draw(4.55,-1) node{$4$};}
\visible<9->{\draw(6.125,-1) node{$3$};}
\visible<11->{\draw(7.875,-1) node{$2$};}
\visible<13->{\draw(9.625,-1) node{$1$};}
\visible<16->{\draw(4,-3) node{\( =720 \)\text{通り}};}
\visible<17->{\draw(8,-3) node[CUDGreen]{\( \times2 \)\text{倍}};}
\visible<18->{\draw(5.5,-4.5)
	node{\( =1440 \)\text{通り\ \ittan}};}
\end{tikzpicture}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}[t]
\frametitle{よって答えは}
\vspace*{-4ex}
\begin{eqnarray*}
& & \text{女子$2$人が隣り合わない並び方}\\[1.3ex]\pause
&=& \text{\textcolor{CUDRed}{すべての並び方}}
	- \text{\textcolor{CUDBlue}{女子$2$人が隣り合う並び方}}\\[1.3ex]
								\pause
&=& \makebox[7zw][c]{\textcolor{CUDRed}{\(5040\)\text{通り}}}
	-\makebox[12zw][c]{\textcolor{CUDBlue}{\(1440\)\text{通り}}}\\[1.3ex]
								\pause
&=& \hskip0.2\textwidth 3600\text{通り}\quad\text{\□答}
\end{eqnarray*}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\end{document}
