texlive[72664] Master/texmf-dist: mpchess (26oct24)

commits+karl at tug.org commits+karl at tug.org
Sat Oct 26 22:12:09 CEST 2024


Revision: 72664
          https://tug.org/svn/texlive?view=revision&revision=72664
Author:   karl
Date:     2024-10-26 22:12:09 +0200 (Sat, 26 Oct 2024)
Log Message:
-----------
mpchess (26oct24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/metapost/mpchess/README.md
    trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.pdf
    trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex
    trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.pdf
    trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex
    trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex
    trunk/Master/texmf-dist/metapost/mpchess/mpchess.mp

Modified: trunk/Master/texmf-dist/doc/metapost/mpchess/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mpchess/README.md	2024-10-25 23:41:58 UTC (rev 72663)
+++ trunk/Master/texmf-dist/doc/metapost/mpchess/README.md	2024-10-26 20:12:09 UTC (rev 72664)
@@ -71,7 +71,7 @@
 A dedicated git repository is available:
 [https://plmlab.math.cnrs.fr/mchupin/mpchess-pieces](https://plmlab.math.cnrs.fr/mchupin/mpchess-pieces)
 and
-[https://github.com/chupinmaxime/mpchess](https://github.com/chupinmaxime/mpchess).
+[https://github.com/chupinmaxime/mpchess-pieces](https://github.com/chupinmaxime/mpchess-pieces).
 
 A TrueType font is available.  
 ## Contact

Modified: trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex	2024-10-25 23:41:58 UTC (rev 72663)
+++ trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex	2024-10-26 20:12:09 UTC (rev 72664)
@@ -68,8 +68,8 @@
 }
 \vfill
 \begin{center}
-  Version 0.7, 2023, July, 20th \\
-  \url{https://plmlab.math.cnrs.fr/mchupin/mpchess}
+  Version 0.8, 2024, October, 26th \\
+  \url{https://gitlab.gutenberg-asso.fr/mchupin/mpchess}
 \end{center}
 %% == Page de garde ====================================================
 \newpage
@@ -297,7 +297,9 @@
 \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,12 +361,42 @@
   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}
 
 \paragraph{Colors.}
@@ -1448,8 +1480,11 @@
 \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.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 +1496,6 @@
 \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

Modified: trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex	2024-10-25 23:41:58 UTC (rev 72663)
+++ trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex	2024-10-26 20:12:09 UTC (rev 72664)
@@ -71,8 +71,8 @@
 }
 \vfill
 \begin{center}
-  Version 0.7, 20 juillet 2023 \\
-  \url{https://plmlab.math.cnrs.fr/mchupin/mpchess}
+  Version 0.8, 26 octobre 2024 \\
+  \url{https://gitlab.gutenberg-asso.fr/mchupin/mpchess}
 \end{center}
 %% == Page de garde ====================================================
 \newpage
@@ -292,11 +292,13 @@
 \item \lstinline+"GreenLichess"+;
 \item \lstinline+"PinkPyramidalLichess"+;
 \item \lstinline+"Wood"+;
-\item ou \lstinline+"Classical"+.
+\item \lstinline+"Classical"+;
+\item \lstinline+"Dotted"+;
+\item ou \lstinline+"User"+.
 \end{itemize}
 \end{description}
 
-Les exemples suivants montrent les résultats obtenus.
+Les exemples suivants montrent les résultats obtenus pour les thèmes prédéfinis.
 \begin{ExempleMP}
 input mpchess
 beginfig(0);
@@ -355,10 +357,40 @@
   draw backboard;
   endfig;
 \end{mplibcode}\\
+Thème \lstinline+"Dotted"+&\\
+\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{Les différents thèmes de couleur fournis par \mpchess.}\label{tab:color}
 \end{table}
 
+L’utilisation de \lstinline+"User"+ est un cas particulier, car il permet de
+définir soit même les casses noires et blanches. Pour que cela fonctionne, il
+faut définir en plus une macro \lstinline+buildUserSquare+\index{buildUserSquare@\lstinline+buildUserSquare+} qui construit les
+images (\lstinline+picture+) internes \lstinline+_blackSquarePic+\index{_blackSquarePic@\lstinline+_blackSquarePic+} et
+\lstinline+_whiteSquarePic+\index{_whiteSquarePic@\lstinline+_whiteSquarePic+} dont voici un prototype :
+\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}
+La macro prend en argument une unité, et doit construire deux carrés de côté
+cette unité. 
+
+
 \subsubsection{Configuration d’un thème personnel}
 
 \paragraph{Couleurs.}
@@ -1424,6 +1456,9 @@
 \section{Historique}
 
 \begin{description}
+  \item[v0.8, 26 octobre 2024:] Ajout du thème d’échiquier \lstinline+"Dotted"+
+  et ajout du thème d’échiquier \lstinline+"User"+ qui permet à l’utilisateur ou
+  l’utilisatrice de définir les casses blanches et noires. 
 \item[v0.7, juillet 2023:] Ajustement du cavalier noir, ajout de thèmes
 d'échiquier (\lstinline+GreenLichess+, \lstinline+PinkPyramidalLichess+,
 \lstinline+Wood+ avec des types de coloriage (\lstinline+set_board_type+). 

Modified: trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex	2024-10-25 23:41:58 UTC (rev 72663)
+++ trunk/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex	2024-10-26 20:12:09 UTC (rev 72664)
@@ -97,7 +97,7 @@
   set_no_coords,set_white_view,set_black_view,
   set_white_player,set_black_player,set_pieces_theme,set_players_side,init_chessboard,set_empty_chessboard,add_white_pieces,add_black_pieces,clear_areas,clear_files,clear_ranks,clear_squares,build_chessboard_from_fen,build_chessboards_from_pgn,clear_chessboard,
   color_square,draw_arrows,draw_circles,draw_comment,draw_crosses,get_halfmove_number,get_totalmove_number,
-  reset_mpchess,set_black_to_move,set_last_move_color,set_comment_color,set_white_to_move,set_whos_to_move,show_last_move,unset_whos_to_move,set_arrow_width,clip_chessboard,build_chessboard_from_fen_file,build_chessboard_from_pgn_file,draw_black_main_lines,draw_black_main_lines_step,draw_white_main_lines,draw_white_main_lines_step,set_main_lines_color,set_possible_moves_color,show_possible_moves,show_possible_moves_step,hide_coordinates,hide_whos_to_move,set_black_squares_color,set_coordinates_font,set_coordinates_position,set_white_squares_color,show_coordinates,show_whos_to_move,set_board_type},
+  reset_mpchess,set_black_to_move,set_last_move_color,set_comment_color,set_white_to_move,set_whos_to_move,show_last_move,unset_whos_to_move,set_arrow_width,clip_chessboard,build_chessboard_from_fen_file,build_chessboard_from_pgn_file,draw_black_main_lines,draw_black_main_lines_step,draw_white_main_lines,draw_white_main_lines_step,set_main_lines_color,set_possible_moves_color,show_possible_moves,show_possible_moves_step,hide_coordinates,hide_whos_to_move,set_black_squares_color,set_coordinates_font,set_coordinates_position,set_white_squares_color,show_coordinates,show_whos_to_move,set_board_type,buildUserSquare,_blackSquarePic,_whiteSquarePic},
   keywordstyle=\color{darkred},
   classoffset=2,% frame=tb
   morekeywords={backboard,chessboard,chessboard_step},

Modified: trunk/Master/texmf-dist/metapost/mpchess/mpchess.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/mpchess/mpchess.mp	2024-10-25 23:41:58 UTC (rev 72663)
+++ trunk/Master/texmf-dist/metapost/mpchess/mpchess.mp	2024-10-26 20:12:09 UTC (rev 72664)
@@ -2,7 +2,7 @@
 %%                        mpchess.mp                          %%
 %%              draw chessboards with metapost                %%
 %%                    notezik at gmail.com                       %%
-%%                Version 0.7 (juillet   2023)                %%
+%%                Version 0.8 (octobre   2024)                %%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
 % This work may be distributed and/or modified under the conditions of
@@ -15,6 +15,8 @@
 
 %input format;
 input hatching;
+%input minim-mp;
+%input minim-hatching;
 input mpchess-pieces; % piece of mpchess package
 input mpchess-cburnett; % piece of lichess cburnett
 input mpchess-skak; % piece of skak package
@@ -258,6 +260,27 @@
     );
 enddef;
 
+def _buildDottedSquare(expr _SquareUnit)=
+    _blackSquarePic:=image(
+        fill (unitsquare scaled _SquareUnit) withcolor white;
+        save N;
+        N:= 11;
+        for i:=0 upto N+1:
+            for j:=0 upto N+1:
+                fill (fullcircle shifted (1/N*i*_SquareUnit if odd(j): +1/(2*N)*_SquareUnit fi,1/N*j*_SquareUnit))
+                ;
+            endfor;
+        endfor;
+        draw (unitsquare  scaled _SquareUnit);
+        clip currentpicture to (unitsquare  scaled _SquareUnit);
+    );
+    _whiteSquarePic:=image(
+        fill unitsquare scaled _SquareUnit withcolor white;
+        draw (unitsquare  scaled _SquareUnit);
+        clip currentpicture to (unitsquare  scaled _SquareUnit);
+    );
+enddef;
+
 % default theme lichess blue
 _blackSquarePic:=_blackSquareColoredPic;
 _whiteSquarePic:=_whiteSquareColoredPic;
@@ -287,6 +310,9 @@
     elseif(t="Classical"):
         _blackColorSquare:=black;
         _whiteColorSquare:=black;
+    elseif(t="Dotted"):
+        _blackColorSquare:=black;
+        _whiteColorSquare:=black;
     fi
 enddef;
 
@@ -561,6 +587,10 @@
 _init_piece(_chessSquareU);
 if(_chessTheme="Classical"):
     _buildClassicalSquare(_chessSquareU);
+elseif(_chessTheme="Dotted"):
+    _buildDottedSquare(_chessSquareU);
+elseif(_chessTheme="User"):
+    buildUserSquare(_chessSquareU);
 else: % colored themes
     _buildColoredSquare(_chessSquareU,_blackColorSquare,_whiteColorSquare);
 fi



More information about the tex-live-commits mailing list.