% \iffalse % -------------------------------------------------------------------- %<*utils> % \fi % % \subsubsection{Miscellaneous macros} % \begin{Macro}{\wargamelogo} % % This will produce the logo for this package. % % % \begin{center} % \tikz{\wargamelogo} % \end{center} % % \begin{macrocode} \tikzset{ wargame logo text/.style={ font=\sffamily\bfseries\fontsize{12}{14}\selectfont, scale=2.8, inner sep=0, text width=1.8cm, transform shape, align=center}, wargame logo text content/.store in=\wg@logo@text@content, wargame logo text content={{\huge\LaTeX} wargame}, wargame logo chit/.style={ chit={symbol={[ faction=friendly, command=land, echelon=division, main=infantry]}, factors={chit/2 factors={4,3}}, left={chit/identifier=III}, right={chit/small identifier={10\textsuperscript{th}}}, color=white, fill=red!50!black } }, wargame logo/.style={ transform shape, every hex/.style={fill=gray!5!white,draw=gray!75!black}, hex/first row is=0, hex/first column is=0, hex/short top columns=none, hex/short bottom columns=none, hex/row direction is=normal, hex/column direction is=normal } } \newcommand\wargamelogo[1][]{% \begin{scope}[wargame logo,#1] \node[hex={fill=gray!30!white}] (logo center) at (hex cs:c=0,r=0) {}; \node[hex={terrain=light woods}](logo light woods) at (hex cs:c=0,r=1) {}; \node[hex={terrain=city}] (logo city) at (hex cs:c=0,r=-1){}; \node[hex={terrain=woods}] (logo woods) at (hex cs:c=-1,r=0){}; \node[hex={terrain=mountains}] (logo mountains) at (hex cs:c=-1,r=1){}; \node[hex={terrain=beach}] (logo beach) at (hex cs:c=1,r=1) {}; \node[hex={terrain=swamp}] (logo swamp) at (hex cs:c=1,r=0) {}; \node[wargame logo chit] (logo chit) at (hex cs:) {}; \node[wargame logo text] (logo text) {\wg@logo@text@content}; \end{scope}} % \end{macrocode} % % \end{Macro} % \begin{Macro}{\wg@dbg} % Debugging support. The counter \cs{wargamedbglvl} sets the debug % level. The package code then uses \cs{wg@dbg} to print out % debugging messages. This macro takes two arguments --- the first % is the \emph{least} debug level at which the message is printed, and % the second is the message it self. % % \begin{macrocode} \newcount\wargamedbglvl\wargamedbglvl=0 \def\wg@dbg#1#2{% \ifnum#1>\wargamedbglvl\relax\else\message{^^J#2}\fi} % \end{macrocode} % \end{Macro} % % \begin{Macro}{\wg@addto@macro} % % The macro \cs{wg@addto@macro}\marg{macro}\marg{other} adds the % definition of the macro \meta{other} to the macro \meta{macro}. % This uses the \cs{toks} trick of storing the \emph{tokens} of the % definition of a \meta{macro} and \meta{other} into \spec{@} and % expanding that token into the definition of \meta{macro}. % Effectively, this means that the top-level definition of % \meta{macro} and \meta{other} are expanded (i.e., macros used in % the definition of either macro is \emph{not} expanded) and then % that becomes the new definition of \meta{macro}. % % We will use this macro to do \emph{shallow} definitions of macros % to contain keys and such. % % \begin{macrocode} \long\def\wg@addto@macro#1#2{% \begingroup \toks@\expandafter\expandafter\expandafter{\expandafter#1#2}% \xdef#1{\the\toks@}% \endgroup} % \end{macrocode} % \end{Macro} % % % \begin{Macro}{\wg@sub@nchor} % Get anchor from sub node. We cannot use \cs{pgfpointanchor} since % that returns the anchor coordinates in the global coordinate % system. % % \begin{macrocode} \def\wg@sub@nchor#1#2{% \wg@dbg{3}{^^JGet `#2' in `#1'}% \@ifundefined{pgf@sh@ns@#1}{% \pgf@x=0cm\pgf@y=0cm}{% \pgf@process{% \csname pgf@sh@ma@#1\endcsname% MW \csname pgf@sh@np@#1\endcsname% \pgf@sh@reanchor{\csname pgf@sh@ns@#1\endcsname}{#2}}}% \wg@dbg{10}{-> \the\pgf@x,\the\pgf@y}% } % \end{macrocode} % \end{Macro} % % % Scratch dimensions % % \begin{macrocode} \newdimen\wg@tmpa \newdimen\wg@tmpb \newdimen\wg@tmpc \newdimen\wg@tmpd % \end{macrocode} % % % Macro to easy restore a saved path % % \begin{macrocode} \def\settosave#1{ \pgfsyssoftpath@setcurrentpath{#1}} % \end{macrocode} % % \iffalse % -------------------------------------------------------------------- % % \fi