在 tcolorbox 中打印数字

在 tcolorbox 中打印数字

我能够解决很大一部分问题,试图改变游戏标题以这种方式最后一个问题是处理号码。我该如何修改下面的标题在此处输入图片描述

将其转换为所需的形式(在油漆中绘制,但是数字边框的宽度也可能是默认的):

在此处输入图片描述

我从 PGN4LaTeX 3 中获取并修改的代码是(重要的部分是 begin{tcolorbox})

\documentclass[%
paper=letter,                   % paper size --> A4 is default in Germany
twoside=true,               % onesite or twoside printing
%openright,                 % doublepage cleaning ends up right side
parskip=half,               % spacing value / method for paragraphs
chapterprefix=true,         % prefix for chapter marks
10pt,                       % font size
headings=normal,            % size of headings
bibliography=totoc,         % include bib in toc
listof=totoc,               % include listof entries in toc
titlepage=on,               % own page for each title page
captions=tableabove,        % display table captions above the float env
draft=false,                % value for draft version
twocolumn=false,%
]{scrbook}%
\setlength\columnsep{0.6cm}
\usepackage[
  top=1.3cm,bottom=1.8cm,left=1.85cm,right=1.7cm,%1cm is lost in the middle for each doublepage, right should be 2*(left-1cm) left 2.33cm, right 2.67cm works, 2cm both, too.
  %margin=2.5cm,% each margin should be 2cm
  includeheadfoot,% text area includes header
  nofoot,% no space for footer
  %showframe% show the page layout
]{geometry}

\usepackage{array}
\usepackage{amssymb}
\usepackage{luatex85}
\usepackage[automark]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\clearpairofpagestyles
\ohead{\pagemark}
\chead{\headmark}
%Kopfzeile nicht kursiv
\renewcommand*{\headfont}{\normalfont}


\usepackage{needspace}
\usepackage{xskak}
\usepackage{fmtcount}
%short, stretchable space
\newcommand\shortspace{\ \hspace{-0.167em}}
\xskaknewstyleitem[%
template=UF,
whiteopen=.\shortspace,
blackopen=\ldots\shortspace]{styleN}


\xskaknewstyle[level= 1,styleitem=styleN,font=\bfseries,
           level= 2,styleitem=styleN,
           level= 3,styleitem=styleN,font=\itshape,
           level= 4,styleitem=styleN,
           level= 5,styleitem=styleN]{FK}

\xskakset{style=FK}
\renewcommand\castlinghyphen{\mbox{-}}
\usepackage{latexsym}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{multicol}
\setlength\columnsep{1cm}
\multicoltolerance = 9999
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{imakeidx}
\makeindex[title=Games,columns=1]
\makeindex[name=players,title=Players,columns=3]
\makeindex[name=positions,title=Positions,columns=1]


\newcommand\resetPgnTags{%
  \def\WhitePlayer{}%
  \def\BlackPlayer{}%
  \def\WhiteElo{}%
  \def\BlackElo{}%
  \def\Result{}%
  \def\Site{}%
  \def\Event{}%
  \def\Round{}%
  \def\Date{}%
  \def\Eco{}}

\usepackage{nicefrac}

\newcommand{\arabicz}[1]{\ifnum\value{#1}<100 0\fi\ifnum\value{#1}<10 0\fi\arabic{#1}}
\newcommand\whiteWins{\mbox{1 -- 0}}
\newcommand\blackWins{\mbox{0 -- 1}}
\newcommand\aDraw{\mbox{\nicefrac{1}{2} -- \nicefrac{1}{2}}}
\newcommand\unclearResult{}%was $\ast$
\newcommand\worseis{\scalebox{1.333}[1.273]{$\blacktriangle$}} %ChessBase uses \leq, this is from ChessAssistant
\newcommand\equalis{$=$}
\newcounter{gameNr}
\setcounter{gameNr}{0}

\usepackage{tcolorbox}

\newcommand\gameHeader{%
\refstepcounter{gameNr}%
\vspace{\parskip}%
\ifx\BlackPlayer\empty{}
\needspace{5\baselineskip}%
\def\titletext{\noindent\makebox[0pt][l]{\textbf{\arabic{gameNr}}}%
\makebox[\textwidth][c]{\textbf{\Event{}}}}
\else
\needspace{5\baselineskip}%
\def\titletext{\noindent\makebox[0pt][l]{\textbf{\arabic{gameNr}}}%
\makebox[\textwidth][c]{\textbf{Game}}}
\fi
\begin{tcolorbox}[halign=center,left=3pt,right=3pt,colbacktitle=black!50!white,colframe=black,colback=white,arc=0mm,boxrule=0.7pt,title=\textsf{\titletext},titlerule=0pt]
\ifx\BlackPlayer\empty{}
\WhitePlayer{}
\else
   \mbox{\bfseries $\square$ \WhitePlayer{} \ (\WhiteElo{})}
   \\ \mbox{\bfseries $\blacksquare$ \BlackPlayer{} \ (\BlackElo{})}\\

\ifx\Event\Site{} \ \Date{}\\
\else% 
 \textit{\Event{} \\ \textbf{\Site{} \Date{}}
    \ifx\Round\empty{}
    \else Rd.\Round{}
    \fi}
\fi
\fi
\end{tcolorbox}%

%
%% INDEXING %%%
\ifx\BlackPlayer\empty{}%@\textit{\Event{}}: \WhitePlayer{} (Nr. \arabic{gameNr}%
\index[positions]{\Event{}: \WhitePlayer{}|textbf}\else%
\index{\WhitePlayer{}\BlackPlayer{}\arabicz{gameNr}@\textsc{\WhitePlayer{}} -- \textsc{\BlackPlayer{}}\ \relax%
\ifx\Event\Date{}%
\else%
\textit{\Event{}} \textbf{\Date{}}%
    \if\Round Rd.\Round{}%
    \fi%
\fi%
\ (Nr. \arabic{gameNr})|textbf}%
\fi%
\ifx\BlackPlayer\empty{}%
\else%
\index[players]{\WhitePlayer{}|textbf}%
\index[players]{\BlackPlayer{}|textbf}%
\fi%
\message{Processing game Nr. \arabic{gameNr}}%
}

\newcommand\merke[2][]{
\begin{tcolorbox}[title=\textsf{Regel},arc=0mm,boxrule=0.7pt,center title,colback=orange!5,colframe=orange!93!black,fonttitle=\bfseries,titlerule=0pt,#1]%
#2%
\end{tcolorbox}
}

\newcommand\rwwins{\nopagebreak[4]{\par\centering\textbf{\whiteWins}\par\medskip}}
\newcommand\rbwins{\nopagebreak[4]{\par\centering\textbf{\blackWins}\par\medskip}}
\newcommand\rdraw{\nopagebreak[4]{\par\centering\textbf{\aDraw}\par\medskip}}
\newcommand\runclea{}%{\par\centering\textbf{\unclearResult}\par}}

\frenchspacing

\newcommand\dia{{\,(D)}}
\newcommand\diav{\,(D)}
\newcommand\takes{\capturesymbol}
\newcommand\sn{\symknight}
\newcommand\sk{\symking}
\renewcommand\sb{\symbishop}
\newcommand\sr{\symrook}
\newcommand\sq{\symqueen}
\renewcommand\sp{\sympawn}

\renewcommand\chessdiagramname{\ (D)}

%\newcommand{\chessboards}[1]{\chessboard[pgfstyle=border,padding=0.3ex,linewidth=0.1ex,backregion=h8-a1,#1]}
\newcommand{\chessboards}[1]{\chessboardn[#1]} %no special boards
\newcommand{\chessboardn}[1][]{\chessboard[labelfontsize=10pt,boardfontsize=16.3pt,label=false,marginleft=false,margintopwidth=\baselineskip-11pt,marginbottom=false,#1]\vspace{5pt}}
\newcommand{\chessboardt}[1][]{\chessboard[labelfontsize=9pt,boardfontsize=14pt,label=false,marginleft=false,margintopwidth=\baselineskip-10pt,marginbottom=false,#1]\vspace{5pt}}

\hyphenation{Shake-speare}

\usepackage[hidelinks]{hyperref}
\hypersetup{
colorlinks=false,
linktoc=all
}

%%%setting up the Merida chess font
\pdfmapfile{=chess-enpassant.map}
\setchessboard{
boardfontfamily=merida,
}
\setfigfontfamily{merida}
%%%

\newcommand{\intro}[1]{
\end{multicols}%
\begin{multicols}{2}%
#1
\end{multicols}%
\vspace{\baselineskip}
\needspace{20\baselineskip}%
\begin{multicols}{3}%
}

\usepackage{lmodern}

\usepackage{multicol}

\renewcommand*{\chapterheadstartvskip}{%
  \vspace*{0\baselineskip}%
}%

\renewcommand*{\sectionlinesformat}[4]{%
  \hspace*{#2}%
  \parbox{\dimexpr\linewidth-#2\relax}{\raggedsection
    \ifstr{#3}{}{}{#3\\}%
#4}%
}
%quotation marks according to the current language
\newcommand{\qqstart}{``{}}
\newcommand{\qqend}{''{}}

\begin{document}
%\cleardoublepage

%\tableofcontents
%\cleardoublepage

\begin{multicols}{2}
%\chapter{}
%This is a chapter created by pgn2latex.
\include{pgn2latex_outTest}

\end{multicols}

%\cleardoublepage
%\printindex
%\printindex[players]
%\printindex[positions]

\end{document}

PS pgn2latex_outTest.tex 文件:

\newgame
\resetPgnTags
\def\Event{85th Southwest Open 2019}
\def\Site{Irving USA}
\def\Date{2019}
\def\Round{8.13}
\def\WhitePlayer{Tsay, Vincent}
\def\BlackPlayer{Bajarani, Ulvi}
\def\Result{\whiteWins}
\def\WhiteElo{2164}
\def\BlackElo{2515}
\fenboard{r1qr2k1/2ppbppp/np2p3/p3N3/2PP1B2/6P1/PP2PP1P/2RQ1RK1 w - - 0 15}
\gameHeader


{\par \centering\chessboardn[addfen=r1qr2k1/2ppbppp/np2p3/p3N3/2PP1B2/6P1/PP2PP1P/2RQ1RK1 w - - 0 15] \par}

 [\#]

\mainline[level=1]{ 15. e4 }
 6 minut razdumii

\mainline[level=1]{ 15... Qb7 $2 16. Qh5 $1 }
 4 minuty razdumii

\mainline[level=1]{ 16... g6 17. Qf3 $16 f6 }
 3 minuty razdumii

\mainline[level=1]{ 18. Nd3 }
 9 minut razdumii

\mainline[level=1]{ 18... Rf8 }
 4 minuty razdumii

\mainline[level=1]{ 19. Rfe1 }
 3 minuty razdumii

\mainline[level=1]{ 19... Rf7 20. a3 }
 8 minut razdumii

\mainline[level=1]{ 20... d6 21. Qg4 e5 22. Be3 }
 3 minuty razdumii

\mainline[level=1]{ 22... a4 23. h4 Qc8 24. Qxc8+ }
 4 minuty razdumii

\mainline[level=1]{ 24... Rxc8 25. Nb4 Nb8 }
 4 minuty razdumii

\mainline[level=1]{ 26. c5 $5 }
 6 minut razdumii

\mainline[level=1]{ 26... exd4 27. cxd6 dxe3 $6 }

\variation[level=2]{27... Bxd6 28. Bxd4 Bxb4 29. axb4 $14}

\mainline[level=1]{ 28. dxe7 exf2+ 29. Kxf2 Rxe7 }
 3 minuty razdumii

\mainline[level=1]{ 30. Nd5 Re6 }

\variation[level=2]{30... Rf7 31. Nxb6 $16}

\mainline[level=1]{ 31. Nxc7 $1 Rd6 32. Nd5 $16 Re8 33. Red1 $1 Kf7 34. Rc7+ }
 4 minuty razdumii - ostalos 19m1s

\mainline[level=1]{ 34... Rd7 35. Rdc1 $1 Rxe4 $2 }
 3 minuty razdumii

\variation[level=2]{35... Re6 $8 36. R1c3 $16}

\mainline[level=1]{ 36. Nxb6 $1 $18 }

\variation[level=2]{36. Rxd7+ Nxd7 37. Rc7 Ke6 38. Rxd7 Rd4 $11}

\mainline[level=1]{ 36... Rxc7 }
 3 minuty razdumii

\mainline[level=1]{ 37. Rxc7+ Ke6 38. Rc8 $1 Na6 }
 4 minuty razdumii

\begin{samepage}\mainline[level=1]{ 39. Re8+ Kf5 40. Rxe4 Kxe4 41. Nxa4 h5 42. b4 Nc7 43. Nc5+ Kd4 44. Nd7 } \rwwins\end{samepage}

相关内容