3

I'm creating PDFs with diagrams using latex and have no problem. Using the below, am getting all the diagrams numbered starting from 1 in sequence.

\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}  

But one special requirement is to label the diagrams with something like

1,2,3A,3B,3C,4,5A,5B,5C,5D,5E,6,7A,7B etc....

is there any way I can customize diagram numbering?

Thanks

  • Is this related to diagrams or only with enumerated lists? – Sigur Nov 30 '13 at 15:54
  • 1
    could you turn your snippet into a complete minimal working example (MWE)? It would really help :) – cmhughes Nov 30 '13 at 15:55
  • I pasted my entire code (with few diagrams). Now I need to customize diagram numbering like 1,2,3A,3B,3C,4,5A,5B,5C,5D,5E,6,7A,7B etc.... Another problem I face is that it always ends with a number of next diagram. How can I fix this? Thanks a lot!! – user41006 Nov 30 '13 at 16:29
1

You could define your own numbering command where you have to manually specify the number of each board, like so:

\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}  

enter image description here

  • Thank you "I like to code". I got it done by using itemize and hardcode the label in \item line. But your solution seems even better (also worked) and will use yours. THANKS A LOT!! – user41006 Dec 3 '13 at 4:10
0

If you want to number some figures with a common number (e.g. 3A, 3B, 3C), then it suggests that these three figures are closely related, so that you might want to display them together and use a common caption. If that is the case, you could use the subcaption package. Here is an example slightly adapted from Wikibooks.

\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}

example output

  • Thanks a lot. I'm very basic in these things and am not using "figure" at all in my code. Could you please change my code as per the subcaption and post it here? Thanks for all the help!! – user41006 Nov 30 '13 at 18:17
  • Unfortunately, I can't successfully compile your MWE using pdflatex and so it is not possible for me to fix your code. Sorry. Good luck! – I Like to Code Nov 30 '13 at 19:36
  • Can anyone else help me please? TIA – user41006 Dec 2 '13 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.