0

I would like to have my Table counting like

Table P1.1
Table P1.2
Table P1.3

I tried with \renewcommand{\thetable}{P1.???}, and I do not know what to put on the question marks.

EDIT I wrote this code

\setcounter{figure}{0} \begin{figure}[htbp!] \includegraphics[scale=0.5]{Figures/P1.1.png} \caption{\label{fig:P1.1}When reading from a scale, make sure that you know what each division on the scale represents.} \end{figure}

and I would like that my figure/table have enter image description here

Figure P1.2.png instead of P1.16.2 after using this

\let\oldthetable\thetable \renewcommand{\thetable}{P1.\oldthetable} \let\oldthefigure\thefigure \renewcommand{\thefigure}{P1.\oldthefigure}

3
  • Welcome to tex.se! An MWE or some minimal code that explains your problem is always appreciated. Could you clarify what you want? – Jes Mar 12 at 23:38
  • 1
    In P1.2, what does P1 (or possible P and 1, individually) and 2 represent? – Werner Mar 12 at 23:39
  • @Werner ,,P1`` for ,,part 1``, perhaps? – chsk Mar 13 at 9:40
1

It depends on what the components of your figure/table number represent what you need to do. Here are some options:

  1. P1 is just a prefix and has no connection to anything within your document.

    \let\oldthefigure\thefigure
    \renewcommand{\thefigure}{P1.\oldthefigure}
    \let\oldthetable\thetable
    \renewcommand{\thetable}{P1.\oldthetable}
    
  2. P1 refers to \part one of your document, and is therefore tied to parts.

    \let\oldthefigure\thefigure
    \renewcommand{\thefigure}{P\arabic{part}.\oldthefigure}
    \let\oldthetable\thetable
    \renewcommand{\thetable}{P\arabic{part}.\oldthetable}
    
    
  3. In a numbering that resembles P1.16.2, the 16 represents either a chapter (in the book or report class, or something similar that provides \chapter) or a section (in article, or something similar that doesn't provide \chapter); the former is more common than the latter. For this option you'll have to allow your figure/table numbering to be continuous across these document elements (see Continuous v. per-chapter/section numbering of figures, tables, and other document elements) in addition to updating the counter representation:

    % Continuous figure/table numbering: https://tex.stackexchange.com/q/28333/5764
    \usepackage{chngcntr}
    \counterwithout{figure}{chapter}% or \counterwithout{figure}{section}
    \counterwithout{table}{chapter}% or \counterwithout{table}{section}
    \renewcommand{\thefigure}{P1.\arabic{figure}}
    \renewcommand{\thetable}{P1.\arabic{table}}
    
0

The easiest way I can think of doing this is simply reusing whatever \thetable was before:

\documentclass{article}
\let\oldthetable\thetable
\renewcommand{\thetable}{P1.\oldthetable}
\begin{document}
    \listoftables
    \begin{table}[tp]
        Test 1\caption{Test 1}\label{tab:test1}
    \end{table}
    \begin{table}[tp]
        Test 2\caption{Test 2}\label{tab:test2}
    \end{table}
    \begin{table}[tp]
        Test 3\caption{Test 3}\label{tab:test3}
    \end{table}
\end{document}

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.