为棋局编号并调整 makeevent 文本

为棋局编号并调整 makeevent 文本

我终于调整了我的 .pgn,在 Notepad++ 中手动编辑,并用 texmate 命令替换 PGN 字符串。现在,我需要

a) 调整游戏次数\printanswernumber);

b) 将以 开头的锦标赛名称字符串对齐\chessevent正确的

现在:

在此处输入图片描述 在此处输入图片描述

我需要这样的(我已经在绘画中编辑了,对于不准确之处深表歉意。字体无关紧要): 在此处输入图片描述 在此处输入图片描述

我现在的代码:

\documentclass[12pt,a4paper,openany]{book}
\usepackage{xskak}
\usepackage{texmate}
\newcounter{diagrams}
\newcounter{answers}
\newcommand\printdiagrams{\refstepcounter{diagrams}\thediagrams}
\newcommand\printanswernumber{\refstepcounter{answers}\theanswers}
\setchessboard{showmover=true, moverstyle=triangle, movershift=-1.3ex, moverlift=-1.5ex}
\newcommand\tacticboard[2][]{%
 \noindent\begin{minipage}[t]{0.49\textwidth}
  \centering\printdiagrams\chessboard[#2]\par
   \small\bfseries #1\strut
    \end{minipage}\hfill\ignorespaces }
\begin{document}
\part{Positions}
\chapter{a Deflection and overloading}
\tacticboard{setfen=6k1/4p3/3p2p1/4brp1/7q/1P2B2P/PP1Q2P1/5RK1 b}
\tacticboard{setfen=Bn3rk1/p4p1p/b2P2p1/2p1b1B1/3q4/8/P4RPP/2RQ2K1 b}
\tacticboard{setfen=8/1P6/2n1k3/8/3B1p1p/5P1p/8/5K2 w,moverlift=16.5ex}
\tacticboard{setfen=6k1/1p1b4/3p4/3Pp3/2Q1P1P1/8/3rBq1R/7K b}
\tacticboard{setfen=4r3/PB6/1n6/8/5k2/1P3pp1/2R5/5K2 w,moverlift=16.5ex}

.....

\part{Answers}
\printanswernumber
\chessevent{1st league of AZE ch, Baku, 1988.02.19 (4)}
\whitename{Bajarani, Ilgar}
\blackname{Agamaliev, Gamil}
\whiteelo{-}
\blackelo{-}
\makegametitle

\textbf{29... Bh2+! 30. Kxh2 Rxf1 31. Qd5+} {and now the best way was} \textbf{Kg7! 32.Qxg5} [32. Bxg5 Qe1 33. Qd4+ Kg8 34. Qc4+ d5! 35. Qxd5+ Kh7\BBetter] \textbf{32... Qxg5 33. Bxg5 e5\BBetter}

\printanswernumber
\chessevent{Azerbaijan, 1990}
\whitename{Bajarani, Ilgar}
\blackname{Alieva, Elmira}
\whiteelo{-}
\blackelo{2180}
\makegametitle

20... Bxh2+! 21. Kxh2 Qxf2\unclear

\printanswernumber
\chessevent{1st Fajr open, Tehran, 1991 (7)}
\whitename{Lodhi, Mahmood}
\blackname{Bajarani, Ilgar}
\whiteelo{2415}
\blackelo{2255}
\makegametitle

60. Ba7! h2 61. Kg2\WBetter \whitewins

\printanswernumber
\chessevent{Moscow ol (Men), Moscow, 1994 (12)}
\whitename{Bajarani, Ilgar}
\blackname{Popovic, Petar}
\whiteelo{-}
\blackelo{2530}
\makegametitle

46... Qe1+! 47. Bf1 b5!\BBetter \blackwins

\printanswernumber
\chessevent{Astara, 1996 (4)}
\whitename{Bajarani, Ilgar}
\blackname{Tusi}
\whiteelo{-}
\blackelo{-}
\makegametitle

\textbf{47. a8=Q! Nxa8 48. Rc4+ Kg5} [48... Ke3 49. Rc3+\equal] \textbf{49. Bxf3\equal}

\printanswernumber
\chessevent{Tehran team, 1997.12.19}
\whitename{Salehi Moghaddam, A.}
\blackname{Bajarani, Ilgar}
\whiteelo{-}
\blackelo{-}
\makegametitle

\textbf{57... Bf2\BBetter} {White resigned due to} \textbf{58. Bxf2 Rxh2+ 59. Kg1 Rg2+ 60. Kf1} [60. Kh1 Nxf2\#] \textbf{60... Nh2\# \blackwins}

\printanswernumber
\chessevent{Fajr, Tehran, 1998.02.09 (10)}
\whitename{Bajarani, Ilgar}
\blackname{Moradi, Behrooz}
\whiteelo{-}
\blackelo{-}
\makegametitle

43. Bf7+! Kxf7 44. Qxd7+ Kg6 45. Qxd8\WBetter

\printanswernumber
\chessevent{Dubai open, 1999.05.02 (2)}
\whitename{Alsharhan, Faisal}
\blackname{Bajarani, Ilgar}
\whiteelo{2123}
\blackelo{2362}
\makegametitle

42... Rh2+! 43. Kxh2 Qf2+ 44. Kh1 Bf3+ 45. Qxf3 Qxf3+\BBetter

.....
\end{document}

我怎样才能做到这些?

谨致问候,Ulvi Bajarani

答案1

您可以尝试类似这样的方法。代码假设白方玩家和锦标赛实际上适合在线。我删除了图表和与之相关的代码,因为它们与问题无关。

\documentclass[12pt,a4paper,openany]{book}
\usepackage{xskak}
\usepackage{texmate}
\usepackage{array}


\makeatletter
\newcounter{answers}
\extrarowheight3pt
\newlength\colwidth
\renewcommand*\makegametitle{\par\bigskip\newgame  
    \refstepcounter{answers}%
    \settowidth\colwidth{\fontsize{8mm}{1cm}\bfseries \theanswers}
    \noindent\begin{tabular}{|p{\colwidth}|p{\dimexpr\linewidth-\colwidth-3\tabcolsep-2\arrayrulewidth}@{}}
    \hline
    &
    \strut$\Box$\quad\textbf{\wname}\ \@welo\hfill\mbox{\@tourn}\\
    \raisebox{0.5\ht\strutbox}[0pt][0pt]{\fontsize{8mm}{1cm}\bfseries \theanswers}
    &\strut$\blacksquare$\quad\textbf{\bname}\ \@belo\hfill\@opening\@eco\\
    \hline
    \end{tabular}\par\nopagebreak\bigskip\nopagebreak}

\begin{document}


\chessevent{1st league of AZE ch, Baku, 1988.02.19 (4)}
\whitename{Bajarani, Ilgar}
\blackname{Agamaliev, Gamil}
\whiteelo{-}
\blackelo{-}
\makegametitle

\textbf{29... Bh2+! 30. Kxh2 Rxf1 31. Qd5+} {and now the best way was} \textbf{Kg7! 32.Qxg5} [32. Bxg5 Qe1 33. Qd4+ Kg8 34. Qc4+ d5! 35. Qxd5+ Kh7\BBetter] \textbf{32... Qxg5 33. Bxg5 e5\BBetter}

\chessevent{Azerbaijan, 1990}
\whitename{Bajarani, Ilgar}
\blackname{Alieva, Elmira}
\whiteelo{-}
\blackelo{2180}
\makegametitle

20... Bxh2+! 21. Kxh2 Qxf2\unclear

\chessevent{1st Fajr open, Tehran, 1991 (7)}
\whitename{Lodhi, Mahmood}
\blackname{Bajarani, Ilgar}
\whiteelo{2415}
\blackelo{2255}
\makegametitle

60. Ba7! h2 61. Kg2\WBetter \whitewins

\chessevent{Moscow ol (Men), Moscow, 1994 (12)}
\whitename{Bajarani, Ilgar}
\blackname{Popovic, Petar}
\whiteelo{-}
\blackelo{2530}
\makegametitle

46... Qe1+! 47. Bf1 b5!\BBetter \blackwins


\chessevent{Astara, 1996 (4)}
\whitename{Bajarani, Ilgar}
\blackname{Tusi}
\whiteelo{-}
\blackelo{-}
\makegametitle

\textbf{47. a8=Q! Nxa8 48. Rc4+ Kg5} [48... Ke3 49. Rc3+\equal] \textbf{49. Bxf3\equal}


\chessevent{Tehran team, 1997.12.19}
\whitename{Salehi Moghaddam, A.}
\blackname{Bajarani, Ilgar}
\whiteelo{-}
\blackelo{-}
\makegametitle

\textbf{57... Bf2\BBetter} {White resigned due to} \textbf{58. Bxf2 Rxh2+ 59. Kg1 Rg2+ 60. Kf1} [60. Kh1 Nxf2\#] \textbf{60... Nh2\# \blackwins}


\chessevent{Fajr, Tehran, 1998.02.09 (10)}
\whitename{Bajarani, Ilgar}
\blackname{Moradi, Behrooz}
\whiteelo{-}
\blackelo{-}
\makegametitle

43. Bf7+! Kxf7 44. Qxd7+ Kg6 45. Qxd8\WBetter


\chessevent{Dubai open, 1999.05.02 (2)}
\whitename{Alsharhan, Faisal}
\blackname{Bajarani, Ilgar}
\whiteelo{2123}
\blackelo{2362}
\makegametitle

42... Rh2+! 43. Kxh2 Qf2+ 44. Kh1 Bf3+ 45. Qxf3 Qxf3+\BBetter

.....
\end{document}

在此处输入图片描述

相关内容