1

I need to change reference to table to "табл. CHAPTER_NUM.TABLE_NUM", I was tried to do something like:

\documentclass[a4paper, ukrainian, utf8, 14pt]{extreport}

\setcounter{secnumdepth}{5}

\makeatletter
\renewcommand\p@table{табл. \thechapter.\arabic{table}\expandafter\@gobble}
\makeatother

\begin{document}
\chapter{Chapter}

\section{Section}
Lorem ispum \ref{t:table}.

\begin{table}
  \label{t:table}
\begin{tabular}{| c | c | c | c | c | c |}
\hline
\multicolumn{1}{|p{2cm}|}{Col} &
\multicolumn{1}{p{2.2cm}|}{Lorem} &
\multicolumn{1}{p{2.2cm}|}{Ispum} &
\multicolumn{1}{p{2.2cm}|}{Dolor} \\ \hline 
1  & 50 & 1,44 & 1,85 \\ \hline 
2 & 50 & 1,44 & 1,85 \\ \hline 
3 & 51 & 1,44 & 1,85 \\ \hline 
4  & 45 & 1,44 & 1,85 \\ \hline 
5 & 53 & 1,44 & 1,85 \\ \hline 
  \end{tabular}
\end{table}
\end{document}

enter image description here

it works perfectly with figures, but with tables it doesn't do anything.

Maybe is there any other way to change \ref format?

P.S I'm using XeTex.

6
  • Can you please show us a minimal working exxample to better understand what you are trying to do? I am confused by the current code snippet.
    – Johannes_B
    Commented May 22, 2016 at 12:25
  • Did you think of using the \cref command, from \cleveref? This package is done for that.
    – Bernard
    Commented May 22, 2016 at 12:52
  • Which language is that?
    – Johannes_B
    Commented May 22, 2016 at 13:00
  • @Johannes_B XeTex Commented May 22, 2016 at 13:02
  • I expected something like ukranian or serbian or another language spoken by humans, but ok :-)
    – Johannes_B
    Commented May 22, 2016 at 13:04

1 Answer 1

1

There is no \caption before \label{t:table}, therefore the label is referencing the previous section.

Example file with some other suggestions and some simplifications:

\documentclass[a5paper]{report}% a5paper to get a smaller image for TeX.SX
\usepackage{caption}
\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}

\makeatletter
\renewcommand\p@table{Table.\@ }
\makeatother

\begin{document}
\chapter{Chapter}

\section{Section}
Lorem ispum \ref{t:table}.

\begin{table}
  \centering
  \caption{Table caption}
  \label{t:table}
  \begin{tabular}{
    S[table-format=1.0]
    S[table-format=2.0]
    S[table-format=1.2]
    S[table-format=1.2]
  }
    \toprule
    {Col} & {Lorem} & {Ipsum} & {Dolor} \\
    \midrule
    1  & 50 & 1,44 & 1,85 \\
    2 & 50 & 1,44 & 1,85 \\
    3 & 51 & 1,44 & 1,85 \\
    4  & 45 & 1,44 & 1,85 \\
    5 & 53 & 1,44 & 1,85 \\
    \bottomrule
  \end{tabular}
\end{table}
\end{document}

Result

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .