diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/logicpuzzle/laserbeam/laserbeam.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/logicpuzzle/laserbeam/laserbeam.tex | 321 |
1 files changed, 0 insertions, 321 deletions
diff --git a/Master/texmf-dist/doc/latex/logicpuzzle/laserbeam/laserbeam.tex b/Master/texmf-dist/doc/latex/logicpuzzle/laserbeam/laserbeam.tex deleted file mode 100644 index 7e0fc53bd66..00000000000 --- a/Master/texmf-dist/doc/latex/logicpuzzle/laserbeam/laserbeam.tex +++ /dev/null @@ -1,321 +0,0 @@ -% pdflatex --shell-escape logo.tex -% run twice: 1. download qrcode.png 2. include the pic -% or download http://i.imgur.com/KAunnuS.png and rename it to qrcode.png -% -\documentclass[a4paper]{ltxdoc}% -\usepackage[english]{babel}% -\usepackage[latin1]{inputenc}% -\usepackage[T1]{fontenc}% -\usepackage{textcomp}% -\usepackage{lmodern}% -\usepackage{bera}% -\usepackage{ccicons} -\usepackage{microtype}% -\usepackage{ltxdocext}% -\usepackage{listings} -\usepackage{marginnote}% -\usepackage[svgnames,rgb]{xcolor}% -\usepackage[automark,nouppercase]{scrpage2} -\usepackage[width=4cm,scale=0.59]{laserbeam}% -\usepackage{hyperref} -% -\setlength{\headheight}{1.1\baselineskip}% -% -\AtBeginDocument{\IfFileExists{qrcode.png}{}{\write18{wget -O qrcode.png http://i.imgur.com/KAunnuS.png}}}% -\hypersetup{colorlinks=true,urlcolor=NavyBlue,linkcolor=NavyBlue,citecolor=CornflowerBlue,naturalnames=true,hypertexnames=false}% -\lstset{language=[LaTeX]TeX,numbers=left,numberstyle=\tiny,basicstyle=\ttfamily,frame=single,backgroundcolor=\color{LightGoldenrodYellow},keywordstyle=\color{Blue},emph={puzzlebackground,puzzleforeground,center,laserbeam,left,shape,fill,inner,sep,draw,rounded,corners,thick}, emphstyle=\color{Tomato},emph={[2]Wheat,HotPink,GreenYellow,LightBlue,LightSalmon,LightYellow,green,sudoku,rows,columns,scale},emphstyle={[2]\color{OliveDrab}},morekeywords={laser,mirrorH,,mirrorV,laserH,laserV,placemirror,placearrow,placecross,framepuzzle,setbigcell,setrule,tikzpath,colorarea,framearea,fillarea,laserbeamcell,setrow,LP@cvoffset,titleformat,definecounterstyle,marginnote,tikz,node,puzzlecounter,color,[,]}} -\makeatletter -\renewcommand{\maketitle}% -{% - \thispagestyle{empty}% - \pagecolor{Ivory}% - \begin{titlepage}% - \begin{tikzpicture}[remember picture,overlay]% - \node[yshift=-2cm] at (current page.north west)% - {% - \begin{tikzpicture}[remember picture, overlay]% - \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle% - (\paperwidth,2cm);% - \draw[anchor=west,yshift=-4cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\parbox{15cm}{\RaggedRight\Huge\sffamily\textbf{\@title}}};% - \draw[anchor=west,yshift=-6cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\parbox{15cm}{\huge\sffamily\textbf{\@fileversion}}};% - \draw[anchor=west,yshift=-9cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\parbox{15cm}{\RaggedRight\huge\sffamily\textbf{\@subtitle}}};% - \draw[anchor=west,yshift=-13cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\usebox\logo};% - \draw[anchor=west,yshift=-17cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\parbox{15cm}{\huge\sffamily\textbf{\@date}}};% - \draw[anchor=west,yshift=-20cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\parbox{15cm}{\Large\sffamily{\@authorline\\\textbf{\@author}}}};% - \end{tikzpicture}% - };% - \node[yshift=0cm] at (current page.south west)% - {% - \begin{tikzpicture}[remember picture, overlay]% - \draw[fill=NavyBlue,color=NavyBlue,yshift=6cm,xshift=2cm] (0,0) rectangle (0.2cm,19cm);% - \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);% - \draw[anchor=west,yshift=1cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\parbox{15cm}{\large\sffamily{\@refline}}};% - \end{tikzpicture}% - };% - \end{tikzpicture}% - \end{titlepage}% - \pagecolor{white}% -}% -% -\newcommand*{\@tikzhead}[1]% -{% - \begin{tikzpicture}[remember picture,overlay]% - \node[yshift=-2cm] at (current page.north west)% - {% - \begin{tikzpicture}[remember picture, overlay]% - \draw[fill=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);% - \draw[anchor=west,yshift=1cm,xshift=1.5cm,color=NavyBlue] (0,0) node% - {\parbox{15cm}{\LARGE\sffamily\textbf{\@title}}};% - \node[anchor=east,xshift=.9\paperwidth,rectangle,% - rounded corners=15pt,inner sep=11pt,fill=NavyBlue]% - {\color{white}\textsc{#1}};% - \end{tikzpicture}% - };% - \end{tikzpicture}% -}% -\clearscrheadings% -\ihead{\@tikzhead{\headmark}}% -\cfoot{\upshape\thepage}% -\pagestyle{scrheadings}% -% -%\newcommand*{\headline}[1]{\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}% -\newcommand*{\Headline}[1]{\@mkboth{#1}{#1}}% -% -\renewcommand{\headfont}{\normalfont\mdseries\scshape} -% -\gdef\@subtitle{}% -\providecommand*{\Subtitle}[1]{\gdef\@subtitle{#1}}% -\gdef\@fileversion{}% -\providecommand*{\Fileversion}[1]{\gdef\@fileversion{#1}}% -\gdef\@author{}% -\providecommand*{\Author}[1]{\gdef\@author{#1}}% -\gdef\@authorline{Package author:}% -\providecommand*{\Authorline}[1]{\gdef\@authorline{#1}}% -\gdef\@refline{}% -\providecommand*{\Refline}[1]{\gdef\@refline{#1}}% -\gdef\and{\unskip{}, }% -\newcommand\doubledash{-\kern0.5pt-} -\def\enoteformat{\rightskip\z@ \leftskip\z@ \parindent=1em\leavevmode\llap{\makeenmark}} -\makeatother -% -\def\filename{laserbeam.sty}% -\def\XeLaTeX{Xe\LaTeX}% -% -\newenvironment{optionlist} -{\begin{trivlist}\setlength\leftskip{2em}} -{\end{trivlist}} -\newcommand\optitem[3]{\item [\texttt{\textbf{\textcolor{DodgerBlue}{#1}} \lbrack\textcolor{Crimson}{#2}\rbrack}] #3} -% -\makeatletter% -\renewcommand\tableofcontents% -{% - %\section*{\contentsname}% - \@mkboth{% - \MakeUppercase\contentsname}{\MakeUppercase\contentsname}% - \@starttoc{toc}% -}% -% -\newcommand\styleoption{\name@idx{style option}}% -\newcommand\stylename{\name@idx{document style}}% -\def\name@idx#1#2{% - {\ttfamily#2}% - \index{#2\space#1=\string\ttt{#2}\space#1}\index{#1>#2=\string\ttt{#2}}% -}% -\newcommand*\margcs[1]{\marginnote{\raggedleft\scriptsize #1}}% -\newcommand*\package[1]{\texttt{#1}\index{#1=\string\ttt{#1}}}% -\newcommand*\mco[1]{\mbox{\LANGLE\itshape#1\RANGLE}\index{#1, class option value}\index{class option value>#1}}% -% -\renewcommand\@biblabel[1]{\makebox[1.5cm][l]{[#1]}} -%\renewcommand*\l@subsection{\@dottedtocline{2}{1.2em}{2.8em}} -\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.7em}} -\makeatother -% -\setlength\parindent{0pt}% -\hypersetup{pdfauthor={Josef Kleber},pdftitle={A style file for typesetting Laser Beam logic puzzles},pdfsubject={Documentation for LaTeX style \filename}}% -% -\begin{document} -\title{\filename}% -\Subtitle{A style file for typesetting Laser Beam logic puzzles}% -\author{Josef Kleber} -\Fileversion{v1.0} -\Refline{\href{mailto:josef.kleber@gmx.de}{\texttt{josef.kleber@gmx.de}}\\\href{https://bitbucket.org/kleberj/logicpuzzle/}{\texttt{https://bitbucket.org/kleberj/logicpuzzle/}}} -\newsavebox\logo -\savebox\logo{% - \begin{laserbeam} - \laserV{1} - \laserH{{}} - \mirrorH{{},2} - \mirrorV{{},{},{},{},{},2} - \framepuzzle[LP@c@mirror] - \placearrow{3}{1}{LeftUp} - \placearrow{6}{4}{RightUp} - \placecross{3}{3} - \end{laserbeam} - \hspace{1cm} - \begin{laserbeam} - \laserV{1} - \laserH{{}} - \mirrorH{{},2} - \mirrorV{{},{},{},{},{},2} - \framepuzzle[LP@c@mirror] - \placearrow{3}{1}{LeftUp} - \placearrow{6}{4}{RightUp} - \placecross{3}{3} - \placemirror{2}{2}{V} - \placemirror{4}{2}{H} - \placemirror{5}{5}{V} - \placemirror{3}{5}{H} - \begin{puzzlebackground} - \laser{\tikzpath{3}{1}{7,9,9,9,7,1,7,1,3,3,3,9,9}} - \end{puzzlebackground} - \end{laserbeam} -} -\maketitle -\tableofcontents -\clearpage - -\section{The puzzle} -Draw a laser beam in each grid according to the following guidelines. The beam has to enter or to leave the grid at the arrows. At each intersection, a mirror, on which the laser beam must reflect on one side, can be placed horizontally or vertically. The other side must not be touched by the beam. All locations where the laser crosses are given. The numbers to the left and above the grid indicate how many cells are traversed by the beam in the corresponding row or column. The numbers to the right and below reveal, how many mirrors are found in the intersection of the corresponding row or column. Here's a little self-explanatory example: - -\begin{center} - \usebox\logo -\end{center} - -\bigskip -\begin{lstlisting} -\begin{center} - \begin{laserbeam} - \laserV{1} - \laserH{{}} - \mirrorH{{},2} - \mirrorV{{},{},{},{},{},2} - \framepuzzle[LP@c@mirror] - \placearrow{3}{1}{LeftUp} - \placearrow{6}{4}{RightUp} - \placecross{3}{3} - \end{laserbeam} - \hspace{1cm} - \begin{laserbeam} - \laserV{1} - \laserH{{}} - \mirrorH{{},2} - \mirrorV{{},{},{},{},{},2} - \framepuzzle[LP@c@mirror] - \placearrow{3}{1}{LeftUp} - \placearrow{6}{4}{RightUp} - \placecross{3}{3} - \placemirror{2}{2}{V} - \placemirror{4}{2}{H} - \placemirror{5}{5}{V} - \placemirror{3}{5}{H} - \begin{puzzlebackground} - \laser{\tikzpath{3}{1}{7,9,9,9,7,1,7,1,3,3,3,9,9}} - \end{puzzlebackground} - \end{laserbeam} -\end{center} -\end{lstlisting} -\lstset{basicstyle=\ttfamily\normalsize} - -\section{Options} -\begin{optionlist} - \optitem{\styleoption{rows}}{5}{defines the number of rows in the grid.} - \optitem{\styleoption{columns}}{5}{specifies the number of columns in the grid} - \optitem{\styleoption{width}}{6.5cm}{sets the width of the minipage, in which the grid is typeset.} - \optitem{\styleoption{scale}}{1}{scales the size of the grid in the minipage.} - \optitem{\styleoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}} - \optitem{\styleoption{title}}{}{sets the title of a puzzle.} - \optitem{\styleoption{titleindent}}{0cm}{defines the indent of the title.} - \optitem{\styleoption{titlewidth}}{6.5cm}{specifies the width of the box the title is set in.} - \optitem{\styleoption{bgcolor}}{}{sets the background color of the grid.} - \optitem{\styleoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right} - \optitem{\styleoption{cvoffset}}{-38pt}{sets the vertical offset of the counters in the margin.} -\end{optionlist} - -\section{Environments} -\subsection{\texttt{laserbeam}} -The \env{laserbeam} environment\marginnote{\hbadness=10000\RaggedLeft\scriptsize\envb{laserbeam}\oarg{options}\\\dots\\\enve{laserbeam}} is the central core of the style file. With the optional argument of the environment, you can reset the options with local scope. Here, a blank grid is created. -\subsection{\texttt{puzzlebackground}} -The \env{puzzlebackground} environment\marginnote{\hbadness=10000\RaggedLeft\scriptsize\envb{puzzlebackground}\\\dots\\\enve{puzzlebackground}} allows you to place elements behind the main layer. -\subsection{\texttt{puzzleforeground}} -The \env{puzzleforeground} environment\marginnote{\hbadness=10000\RaggedLeft\scriptsize\envb{puzzleforeground}\\\dots\\\enve{puzzleforeground}} allows you to place elements in front of the main layer. -\section{Commands} -\subsection{In the grid and around} -\subsubsection{\texttt{laserH}} -The command \cs{laserH}\margcs{\cmd\laserH\{\marg{csv list}\}} typesets the numbers above the grid indicating how many cells are traversed by the laser beam. It expects a comma-separated list as an argument. -\subsubsection{\texttt{laserV}} -The command \cs{laserV}\margcs{\cmd\laserV\{\marg{csv list}\}} typesets the numbers left to the grid. -\subsubsection{\texttt{mirrorH}} -The command \cs{mirrorH}\margcs{\cmd\mirrorH\{\marg{csv list}\}} typesets the numbers below the grid indicating how many mirrors are placed in the intersections of this column. -\subsubsection{\texttt{mirrorV}} -The command \cs{mirrorV}\margcs{\cmd\mirrorV\{\marg{csv list}\}} typesets the numbers right to the grid. -\subsubsection{\texttt{placearrow}} -The command \cs{placearrow}\margcs{\cmd\placearrow\{\marg{column}\}\{\marg{row}\}\\\{\marg{direction}\}} is used for the placement of arrows at the grid frame. The reference for coordinates is the bottom left corner of the cell. In the mandatory argument \marg{direction}, you can use the following indicators: LeftUp, LeftDown, RightUp, RightDown -\subsubsection{\texttt{placecross}} -With the command \cs{placecross}\margcs{\cmd\placecross\{\marg{column}\}\{\marg{row}\}} you can place a cross in the intersections of the grid. -\subsubsection{\texttt{placemirror}} -With the command \cs{placemirror}\margcs{\cmd\placemirror\{\marg{column}\}\{\marg{row}\}\\\{\marg{direction}\}} you can place mirrors in the intersections of the grid. In the mandatory argument \marg{direction}, you can use the following indicators: H, V -\subsubsection{\texttt{laser}} -The command \cs{laser}\margcs{\cmd\laser\oarg{color}\{\marg{\cmd\tikz\ path}\}} draws the laser beam given by \marg{\cmd\tikz\ path} with color \oarg{color} (default: red). The reference for coordinates is the bottom left corner of the cell. - -\begin{lstlisting} -\laser[green]{(1,2)--(2,3)--(1,4)} -\end{lstlisting} - -You should consider using this command in the \env{puzzlebackground} environment. - -\subsubsection{\texttt{tikzpath}} -With\margcs{\cmd\tikzpath\{\marg{column}\}\{\marg{row}\}\\\{\marg{csv list}\}} the \cmd\tikzpath\ command, you can easily construct a \cmd\tikz\ path. You just need to define a starting point \marg{column}\marg{row} (bottom left corner) and a \marg{csv list} with direction indicators relative to the current position. - -\begin{center} -\begin{tabular}{rlrlrl} -7: & up left & 8: & up & 9: & up right \\ -4: & left & 5: & no change & 6: & right \\ -1: & down left & 2: & down & 3: & down right \\ -\end{tabular} -\end{center} - -\begin{lstlisting} -\framearea{green}{\tikzpath{2}{2}{8,6,2,4}} -\end{lstlisting} - -This command will frame grid cell \texttt{(2,2)} green. -\subsubsection{\texttt{framepuzzle}} -With\margcs{\cmd\framepuzzle\oarg{color}} the \cmd\framepuzzle\ command, you can frame the grid (thicker line) with the color specified with the optional argument \oarg{color} (default: black). -\subsection{Presentation} -\subsubsection{\texttt{definecounterstyle}} -The command \cs{definecounterstyle}\margcs{\cmd\definecounterstyle\{\marg{name}\}\\\{\marg{definition}\}} allows you to define your own styles. For example, the style \texttt{left} is defined as follows: - -\begin{lstlisting} -\definecounterstyle{left}{ - \begingroup\reversemarginpar\marginnote{ - \tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt, - draw,rounded corners=3pt,thick] - {\Huge\puzzlecounter};}[\LP@cvoffset]\endgroup} -} -\end{lstlisting} - -To typeset the counter into the margin we use the command \cmd\marginnote. We need to use the command \cmd\reversemarginpar\ to set the counter into the left margin. Of course, we must use this command in a group for local scope. Finally we use \cmd\puzzlecounter\ in a \cmd\tikz\ node with a vertical offset set with the option \styleoption{cvoffset}. -\subsubsection{\texttt{puzzlecounter}} -The command \cs{puzzlecounter}\margcs{\cmd\puzzlecounter} provides the counter in textual form to use it for example in \cmd\definecounterstyle. -\subsubsection{\texttt{titleformat}} -With the command \cs{titleformat}\margcs{\cmd\titleformat\{\marg{format}\}}, you can define the format of the title. By default, the definition is as follows: - -\begin{lstlisting} -\titleformat{\centering\Large\color{blue}} -\end{lstlisting} -\subsection{Miscellaneous} -\subsubsection{\texttt{laserbeamsetup}} -With the command \cs{laserbeamsetup}\margcs{\cmd\laserbeamsetup\{\marg{options}\}} you can reset the options with global scope. -\subsubsection{\texttt{setpuzzlecounter}} -With the command \cs{setpuzzlecounter}\margcs{\cmd\setpuzzlecounter\{\marg{number}\}}, you can reset the puzzle counter, for example before the solutions. - -\section{Examples \& Solutions} -You\IfFileExists{qrcode.png}{\marginnote{\href{https://bitbucket.org/kleberj/logicpuzzle/}{\includegraphics[height=2cm]{qrcode.png}}}[-31pt]}{} can download application examples and their solutions from the \href{https://bitbucket.org/kleberj/logicpuzzle/}{project page}. The puzzles are originally licensed under \href{http://creativecommons.org/licenses/by-nc-sa/3.0/}{\ccbyncsa}. -\end{document} |