自定义图表编号

自定义图表编号

我正在使用 latex 创建带有图表的 PDF,没有任何问题。使用下面的方法,我得到了所有图表,它们从 1 开始按顺序编号。

\documentclass[12pt, twocolumn, oneside]{extreport}
\usepackage[paperwidth=8.9in, paperheight=13.9in]{geometry}

\usepackage{pifont}
\usepackage{enumitem}
\usepackage[ps]{skak}
\usepackage{latexsym}

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{indent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
[]}{\end{list}}

\font\logo=logo10
\font\sknf=SkakNew-Figurine
\font\sknfbx=SkakNew-FigurineBold
\font\skndia=SkakNew-DiagramT

\def\Metafont{\mbox{\logo METAFONT}}
\def\resetPgnTags{%
  \def\WhitePlayer{}%
  \def\BlackPlayer{}%
  \def\WhiteElo{}%
  \def\BlackElo{}%
  \def\Result{}%
  \def\Site{}%
  \def\Round{}%
  \def\Date{}%
  \def\Eco{}}

\def\whiteWins{\mbox{1--0}}
\def\blackWins{\mbox{0--1}}
\def\aDraw{\mbox{1/2--1/2}}
\def\unclearResult{$\ast$}

\def\gameHeader{}%\Result{}}

\def\rwwins{{\bfseries\ \whiteWins}}
\def\rbwins{{\bfseries\ \blackWins}}
\def\rdraw{{\bfseries\ \aDraw}}
\def\runclear{\ \unclearResult}

\def\gameskip{}
\def\headerskip{}%\smallskip}
\frenchspacing

\usepackage{fancyhdr}
\pagestyle{fancy}

\chead{{\textsc{\textit{Author} - Testing}} }

\cfoot{}

\headheight = 18pt
\fancyheadoffset{50pt}

\marginparwidth = 0pt
\voffset = -40pt % altura header
\textheight = 860pt %580pt
\setlength{\columnsep}{2in}
\setlength{\columnseprule}{0.2pt} 

\marginparwidth = 0pt

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

\def\whiteWins{\textbf\wdecisive}
\def\blackWins{\textbf\bdecisive}
\def\aDraw{\textbf\equal}
\def\unclearResult{$\ast$}

\largeboard
\showmoveron

\linespread{1}

\begin{document}
\begin{enumerate}[label=\huge\textbf{\arabic*},start=1]
\item 
\item 
\fenboard{5Q2/8/6q1/B2Bp1k1/P1N1Pp2/5K2/8/1N4q1 w - - 0 1}
\centerline{\showboard}
\item 
\fenboard{r1b1k2r/ppppqppp/1bn2n2/4p1N1/2BPP3/1QP5/P4PPP/RNB2RK1 b kq - 0 1}
\centerline{\showboard}
\item 
\fenboard{2r3k1/4qppp/1p3n2/pNrp4/P2Qn3/1P1RN1P1/4PPKP/R7 w - - 0 1}
\centerline{\showboard}
\item 
\fenboard{8/2p3pk/r2p4/B6p/R1PpqP2/3b2PP/1Q3P2/6K1 b - - 0 1}
\centerline{\showboard}
\item 
\fenboard{2b3rk/5pr1/1p1p1n2/p1pP1q1p/P1P2P1n/1QP3PP/4RN1K/2B3RB b - - 0 1}
\centerline{\showboard}

\end{enumerate}
\end{document}  

但有一个特殊要求,就是给图表加上类似这样的标签

1、2、3A、3B、3C、4、5A、5B、5C、5D、5E、6、7A、7B 等....

有什么方法可以自定义图表编号吗?

谢谢

答案1

您可以定义自己的编号命令,其中必须手动指定每个板的编号,如下所示:

\documentclass[12pt, twocolumn, oneside]{extreport}
\usepackage[paperwidth=8.9in, paperheight=13.9in]{geometry}

\usepackage{pifont}
\usepackage{enumitem}
\usepackage[ps]{skak}
\usepackage{latexsym}

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{indent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
[]}{\end{list}}

\font\logo=logo10
\font\sknf=SkakNew-Figurine
\font\sknfbx=SkakNew-FigurineBold
\font\skndia=SkakNew-DiagramT

\def\Metafont{\mbox{\logo METAFONT}}
\def\resetPgnTags{%
  \def\WhitePlayer{}%
  \def\BlackPlayer{}%
  \def\WhiteElo{}%
  \def\BlackElo{}%
  \def\Result{}%
  \def\Site{}%
  \def\Round{}%
  \def\Date{}%
  \def\Eco{}}

\def\whiteWins{\mbox{1--0}}
\def\blackWins{\mbox{0--1}}
\def\aDraw{\mbox{1/2--1/2}}
\def\unclearResult{$\ast$}

\def\gameHeader{}%\Result{}}

\def\rwwins{{\bfseries\ \whiteWins}}
\def\rbwins{{\bfseries\ \blackWins}}
\def\rdraw{{\bfseries\ \aDraw}}
\def\runclear{\ \unclearResult}

\def\gameskip{}
\def\headerskip{}%\smallskip}
\frenchspacing

\usepackage{fancyhdr}
\pagestyle{fancy}

\chead{{\textsc{\textit{Author} - Testing}} }

\cfoot{}

\headheight = 18pt
\fancyheadoffset{50pt}

\marginparwidth = 0pt
\voffset = -40pt % altura header
\textheight = 860pt %580pt
\setlength{\columnsep}{2in}
\setlength{\columnseprule}{0.2pt} 

\marginparwidth = 0pt

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

\def\whiteWins{\textbf\wdecisive}
\def\blackWins{\textbf\bdecisive}
\def\aDraw{\textbf\equal}
\def\unclearResult{$\ast$}

\largeboard
\showmoveron

\linespread{1}

\newcommand{\mynumber}[1]{{\large \textbf{#1}}\linebreak}

\begin{document}

\begin{center}
\fenboard{5Q2/8/6q1/B2Bp1k1/P1N1Pp2/5K2/8/1N4q1 w - - 0 1}
\centerline{\showboard}
\mynumber{1}
\end{center}

\begin{center}
\fenboard{r1b1k2r/ppppqppp/1bn2n2/4p1N1/2BPP3/1QP5/P4PPP/RNB2RK1 b kq - 0 1}
\centerline{\showboard}
\mynumber{2A}
\end{center}


\begin{center}
\fenboard{r1b1k2r/ppppqppp/1bn2n2/4p1N1/2BPP3/1QP5/P4PPP/RNB2RK1 b kq - 0 1}
\centerline{\showboard}
\mynumber{2B}
\end{center}

\end{document}  

在此处输入图片描述

答案2

如果您想用通用数字对一些图形进行编号(例如 3A、3B、3C),则表明这三个图形密切相关,因此您可能希望将它们一起显示并使用通用标题。如果是这种情况,您可以使用该subcaption包。以下是略微改编自维基百科

\documentclass{article}

\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}
        \centering
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[width=\textwidth]{smiley}
                \caption{A gull}
                \label{fig:gull}
        \end{subfigure}%
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
          %(or a blank line to force the subfigure onto a new line)
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[width=\textwidth]{smiley}
                \caption{A tiger}
                \label{fig:tiger}
        \end{subfigure}
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
          %(or a blank line to force the subfigure onto a new line)
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[width=\textwidth]{smiley}
                \caption{A mouse}
                \label{fig:mouse}
        \end{subfigure}
        \caption{Pictures of animals}\label{fig:animals}
\end{figure}
\end{document}

示例输出

相关内容