diff options
Diffstat (limited to 'graphics/metapost/contrib/macros/mpchess/doc/mpchess-doc-en.tex')
-rw-r--r-- | graphics/metapost/contrib/macros/mpchess/doc/mpchess-doc-en.tex | 112 |
1 files changed, 103 insertions, 9 deletions
diff --git a/graphics/metapost/contrib/macros/mpchess/doc/mpchess-doc-en.tex b/graphics/metapost/contrib/macros/mpchess/doc/mpchess-doc-en.tex index 5ad5abdb1a..e11a860be4 100644 --- a/graphics/metapost/contrib/macros/mpchess/doc/mpchess-doc-en.tex +++ b/graphics/metapost/contrib/macros/mpchess/doc/mpchess-doc-en.tex @@ -68,8 +68,8 @@ } \vfill \begin{center} - Version 0.7, 2023, July, 20th \\ - \url{https://plmlab.math.cnrs.fr/mchupin/mpchess} + Version 0.9, 2024, Decembre, 16th \\ + \url{https://gitlab.gutenberg-asso.fr/mchupin/mpchess} \end{center} %% == Page de garde ==================================================== \newpage @@ -86,7 +86,7 @@ \begin{center} - \url{https://plmlab.math.cnrs.fr/mchupin/mpchess} + \url{https://gitlab.gutenberg-asso.fr/mchupin/mpchess} \url{https://github.com/chupinmaxime/mpchess} \end{center} @@ -297,7 +297,9 @@ command: \item \lstinline+"GreenLichess"+; \item \lstinline+"PinkPyramidalLichess"+; \item \lstinline+"Wood"+; -\item or \lstinline+"Classical"+. +\item \lstinline+"Classical"+; +\item \lstinline+"Dotted"+; +\item or \lstinline+"User"+; \end{itemize} \end{description} @@ -359,11 +361,41 @@ The table~\ref{tab:color} shows the different results of the different themes. draw backboard; endfig; \end{mplibcode}\\ +\lstinline+"Dotted"+ theme& \\ +\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("Dotted"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode}&\\ \end{tabular} \caption{The different color themes provided by \mpchess.}\label{tab:color} \end{table} - +The use of \lstinline+"User"+ is a special case, as it allows you to +define black and white squares. For this to work +a another macro +\lstinline+buildUserSquare+\index{buildUserSquare@\lstinline+buildUserSquare+} +should be difined. It must build the +images (\lstinline+picture+) \lstinline+_blackSquarePic+\index{_blackSquarePic@\lstinline+_blackSquarePic+} and +\lstinline+_whiteSquarePic+\index{_whiteSquarePic@\lstinline+_whiteSquarePic+}. +Here is a prototype of such a command. +\begin{mpcode} + def buildUserSquare(expr _SquareUnit)= + _blackSquarePic:=image( + fill (unitsquare scaled _SquareUnit) withcolor red; + ); + _whiteSquarePic:=image( + fill unitsquare scaled _SquareUnit withcolor green; + ); + enddef; +\end{mpcode} +The macro takes a unit as argument, and must construct two squares with length +equal to this unit. \subsubsection{Configuring a Personal Color Theme} @@ -654,6 +686,64 @@ in version 0.6, \lstinline+set_whos_to_move+ and \commande|hide_whos_to_move|\index{hide_whos_to_move@\lstinline+hide_whos_to_move+}\smallskip +It is now possible to change the appearance of the marker (since +version 0.9\footnote{Thanks to Udi Fogiel for fixing a placement bug and +for suggesting improvements.}. For this purpose, \mpchess provides three styles: +\lstinline+"triangle"+ (default), \lstinline+"square"+ and \lstinline+"disk"+. +To select the marker type, use the following command: + +\commande|set_marker_type(«string»)|\index{set_marker_type@\lstinline+set_marker_type+}\smallskip + +\begin{description} + \item[\meta{string}] may be +\begin{itemize} + \item \lstinline+"triangle"+ (default value); + \item \lstinline+"square"+; +\item \lstinline+"disk"+; +\item \lstinline+"custom"+. +\end{itemize} +\end{description} + +You can adjust the size (by a factor of the unit dimension) with the following +command: + +\commande|set_marker_scale(«numeric»)|\index{set_marker_scale@\lstinline+set_marker_scale+}\smallskip + +\begin{description} + \item[\meta{numeric}:] is a unit dimension factor for enlarging or + shrink the mark (default value is \num{0.35}). +\end{description} + +The \lstinline+"custom"+ marker type value lets you define the marker's +appearance. When this option is called, a +macro \MP{} \lstinline+custom_maker(expr s,r)+ must be defined. The +\lstinline+s+ parameter is the scale factor setting: the markers supplied by +\mpchess are drawings contained in a square of side 1 (\MP{} unit) and scaled +by \lstinline+s*_chessSquareU+. The \lstinline+r+ parameter is a boolean that +handles the case where the marker is rotated 180 degrees +when placed at the top of the chessboard. + +For example, a \lstinline+custom_marker+ macro reproducing the triangle symbol might be as follows: +\begin{mpcode} +def custom_marker(expr s, r)= + ((0,0)--(1,0)--(0.5,0.5)--cycle) if r: rotatedaround((0.5, 0.5/3), 180) fi scaled (s*_chessSquareU) +enddef; +\end{mpcode} + +Only the outline is defined, which will be filled by either white or black. + + +\begin{ExempleMP} +input mpchess +beginfig(0); +set_marker_type("disk"); +set_marker_scale(0.5); +init_backboard; +draw backboard; +init_chessboard; +draw chessboard; +endfig; +\end{ExempleMP} \subsection{Draw a Position} The commands described below allow you to build a position in several ways @@ -1448,8 +1538,14 @@ endfig; \section{History} \begin{description} -\item[v0.7, juillet 2023:] Black knight adjustment, adding color board themes (\lstinline+GreenLichess+, \lstinline+PinkPyramidalLichess+, -\lstinline+Wood+ with color type (\lstinline+set_board_type+). +\item[v0.9, December 16, 2024:] Correction of a bug in the placement of the +trait marker (by Udi Fogiel), added different marker features (\lstinline ++"triangle"+, \lstinline+"square"+,\lstinline+"disk"+ and \lstinline+"custom"+). Filling of the white marker. +\item[v0.8, October 26, 2024:] Adding \lstinline+"Dotted"+ board theme, and +\lstinline+"User"+ board theme that allows user to define black and white +squares. +\item[v0.7, July, 2023:] Black knight adjustment, adding color board themes (\lstinline+GreenLichess+, \lstinline+PinkPyramidalLichess+, +\lstinline+Wood+ with color type (\lstinline+set_board_type+)). \item[v0.6, April 26, 2023:] Fixed bugs concerning castling management, and moves ambiguities in \textsc{pgn} format. Changed \lstinline+set_white_color+ to @@ -1461,8 +1557,6 @@ Changed \lstinline+set_white_color+ to \lstinline+hide_whos_to_move+. Change \lstinline+set_coords_inside+ and \lstinline+set_coords_outside+ to \lstinline+set_coordinates_position+. Change \lstinline+set_coords_font+ to \lstinline+set_coordinates_font+. - -Translated with www.DeepL.com/Translator (free version) \item[v0.5, April 20, 2023:] Bug fixed, \textbf{changing the default piece set} for the \lstinline+mpchess+ set (which has been added to Lichess), added TrueType font, and updated documentation. \item[v0.4, April 6, 2023:] Corrections in the documentation, especially the |