根据图号更改后缀

根据图号更改后缀

在土耳其语中(可能还有其他类似的语言),后缀会根据所用的单词而变化。数字也是如此。

例如,

in Figure \ref{fig1}

用土耳其语写成如下:

Şekil \ref{fig1}'de

这里的问题是后缀"de"应该根据它之前渲染的数字而变化。它应该是这样的

1'de, 2'de, 3'te, 4'te, 5'te, 6'da, ..., 60'ta, ..., 70'te, ...

我不喜欢在论文完成后手动检查后缀。对于方程式等其他交叉引用,情况也是如此。

我怎样才能在 LaTeX 中做到这一点?

编辑:我正在按照@egreg 的要求添加完整规则。确定的数字如下:

0'da
1'de
2'de
3'te
4'te
5'te
6'da
7'de
8'de
9'da
10'da
20'de
30'da
40'da
50'de
60'ta
70'te
80'de
90'da
100'de
1000'de
1000000'da
1000000000'da

对于所有其他字符,末尾的数字决定了后缀(如果非零)。例如

1234'te  (4'te)
303'te (3'te)

但是,如果末尾有一个零,并且数字不为零,则最右边的非零数字决定结果:

230'da (30'da)
200'de (100'de)
4000'de (1000'de)
40000'de (1000'de)
400000'de (1000'de)
4000000'da (1000000'da)

后缀由最后一个读出的单词决定。例如,40000 读作“kırk bin”,读作“40000'de”。这与“1000'de”读作“binde”相同。

答案1

这是使用 LaTeX3 的可能实现:

\documentclass{article}
\usepackage[turkish]{babel}
\usepackage{refcount}
\usepackage{xparse}

\usepackage{multicol} % only needed for the test

\ExplSyntaxOn
\NewDocumentCommand{\turkishref}{sm}
 {
  \IfBooleanTF{#1}{\ref*{#2}}{\ref{#2}}
  \turksuf_suffix_get:n { #2 }
 }

\seq_new:N \l__turksuf_ref_seq
\tl_new:N \l__turksuf_ref_tl
\cs_new_protected:Npn \turksuf_suffix_get:n #1
 {
  \seq_set_split:Nnx \l__turksuf_ref_seq { . } { \getrefnumber { #1 } }
  \seq_pop_right:NN \l__turksuf_ref_seq \l__turksuf_ref_tl
  \turksuf_suffix:V \l__turksuf_ref_tl
 }
\cs_generate_variant:Nn \seq_set_split:Nnn { Nnx }

\NewDocumentCommand{\turkishsuffix}{m}
 {
  \turksuf_suffix:n { #1 }
 }

\cs_new:Npn \turksuf_suffix:n #1
 {
  \int_compare:nTF { #1 == 0 } { 'da } { \turksuf_nonzero:n { #1 } }
 }
\cs_new:Npn \turksuf_nonzero:n #1
 {
  \int_case:nnF { #1 }
   {
    {1}{'de}
    {2}{'de}
    {3}{'te}
    {4}{'te}
    {5}{'te}
    {6}{'da}
    {7}{'de}
    {8}{'de}
    {9}{'da}
    {10}{'da}
    {20}{'de}
    {30}{'da}
    {40}{'da}
    {50}{'de}
    {60}{'da}
    {70}{'de}
    {80}{'de}
    {90}{'da}
    {100}{'de}
    {1000}{'de}
   }
   {
    \turksuf_complex:n { #1 }
   }
 }
\cs_generate_variant:Nn \turksuf_suffix:n { V }

\cs_new:Npn \turksuf_complex:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 10 } = 0 }
   { \turksuf_complex_ten:n { #1 } }
   { \turksuf_nonzero:n { \int_mod:nn { #1 } { 10 } } }
 }

\cs_new:Npn \turksuf_complex_ten:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 100 } = 0 }
   { \turksuf_complex_hundred:n { #1 } }
   { \turksuf_nonzero:n { \int_mod:nn { #1 } { 100 } } }
 }
\cs_new:Npn \turksuf_complex_hundred:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 1000 } = 0 }
   { \turksuf_complex_thousand:n { #1 } }
   { 'de }%{ \turksuf_nonzero:n { \int_mod:nn { #1 } { 1000 } } }
 }
\cs_new:Npn \turksuf_complex_thousand:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 10000 } = 0 }
   { \turksuf_complex_tenthousand:n { #1 } }
   { 'de }%{ \turksuf_nonzero:n { \int_mod:nn { #1 } { 10000 } } }
 }
\cs_new:Npn \turksuf_complex_tenthousand:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 100000 } = 0 }
   { \turksuf_complex_hundredthousand:n { #1 } }
   { 'de }%{ \turksuf_nonzero:n { \int_mod:nn { #1 } { 100000 } } }
 }
\cs_new:Npn \turksuf_complex_hundredthousand:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 1000000 } = 0 }
   { \turksuf_complex_million:n { #1 } }
   { 'da }%{ \turksuf_nonzero:n { \int_mod:nn { #1 } { 1000000 } } }
 }
\NewDocumentCommand\test{m}
 {
  \int_step_inline:nnnn { 0 } { 1 } { #1 }
   { ##1\turkishsuffix{##1}\par }
 }
\ExplSyntaxOff

\setlength{\parindent}{0pt} % just for the test

\begin{document}
\begin{multicols}{5}
\test{300}
\end{multicols}

\setcounter{figure}{12}
\begin{figure}
\caption{X}\label{A}
\end{figure}
\figurename~\turkishref{A}.

1234\turkishsuffix{1234}\\
1320\turkishsuffix{1320}\\
1330\turkishsuffix{1330}\\
1000\turkishsuffix{1000}\\
1003\turkishsuffix{1003}

\setcounter{section}{1}
\setcounter{subsection}{3}
\subsection{B}\label{B}

Subsection~\turkishref{B}

\end{document}

我仅显示最后几行并参考该图和以下测试用例。

笔记已添加对“合数”的支持。此外,还有一个\turkishref*调用\ref*而不是\ref(当然,hyperref这是实现此功能所必需的)。

在此处输入图片描述


这是代码的打包版本。保存为turkref.styTeX 程序搜索到的任何地方,例如

~/texmf/tex/latex/turkref/

在 GNU/Linux 系统上或

~/Library/texmf/tex/latex/turkref/

适用于 Mac OS X。

\RequirePackage{expl3,xparse}
\ProvidesExplPackage{turkref}{2014/12/11}{0.1}{Turkish suffix for ref}

\@ifpackagelater { expl3 } { 2012/11/21 }
 { }
 {
  \PackageError { turkref } { Support~package~expl3~too~old }
   {
    You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~
    'l3packages'.\MessageBreak
    Loading~turkref~will~abort!
   }
  \tex_endinput:D
 }

\RequirePackage{refcount}

% User commands
\NewDocumentCommand{\turkishref}{sm}
 {
  \IfBooleanTF{#1}{\ref*{#2}}{\ref{#2}}
  \turksuf_suffix_get:n { #2 }
 }

\NewDocumentCommand{\turkishsuffix}{m}
 {
  \turksuf_suffix:n { #1 }
 }

% Variables
\seq_new:N \l__turksuf_ref_seq
\tl_new:N \l__turksuf_ref_tl

\cs_new_eq:NN \turksuf_getrefnumber:n \getrefnumber

% Functions
\cs_new_protected:Npn \turksuf_suffix_get:n #1
 {
  \seq_set_split:Nnx \l__turksuf_ref_seq { . } { \turksuf_getrefnumber:n { #1 } }
  \seq_pop_right:NN \l__turksuf_ref_seq \l__turksuf_ref_tl
  \turksuf_suffix:V \l__turksuf_ref_tl
 }
\cs_generate_variant:Nn \seq_set_split:Nnn { Nnx }

\cs_new:Npn \turksuf_suffix:n #1
 {
  \int_compare:nTF { #1 == 0 } { 'da } { \__turksuf_nonzero:n { #1 } }
 }

\cs_new:Npn \__turksuf_nonzero:n #1
 {
  \int_case:nnF { #1 }
   {
    {1}{'de}
    {2}{'de}
    {3}{'te}
    {4}{'te}
    {5}{'te}
    {6}{'da}
    {7}{'de}
    {8}{'de}
    {9}{'da}
    {10}{'da}
    {20}{'de}
    {30}{'da}
    {40}{'da}
    {50}{'de}
    {60}{'da}
    {70}{'de}
    {80}{'de}
    {90}{'da}
    {100}{'de}
    {1000}{'de}
   }
   {
    \__turksuf_complex:n { #1 }
   }
 }
\cs_generate_variant:Nn \turksuf_suffix:n { V }

\cs_new:Npn \__turksuf_complex:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 10 } = 0 }
   { \__turksuf_complex_ten:n { #1 } }
   { \__turksuf_nonzero:n { \int_mod:nn { #1 } { 10 } } }
 }

\cs_new:Npn \__turksuf_complex_ten:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 100 } = 0 }
   { \__turksuf_complex_hundred:n { #1 } }
   { \__turksuf_nonzero:n { \int_mod:nn { #1 } { 100 } } }
 }
\cs_new:Npn \__turksuf_complex_hundred:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 1000 } = 0 }
   { \__turksuf_complex_thousand:n { #1 } }
   { 'de }
 }
\cs_new:Npn \__turksuf_complex_thousand:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 10000 } = 0 }
   { \__turksuf_complex_tenthousand:n { #1 } }
   { 'de }
 }
\cs_new:Npn \__turksuf_complex_tenthousand:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 100000 } = 0 }
   { \__turksuf_complex_hundredthousand:n { #1 } }
   { 'de }
 }
\cs_new:Npn \__turksuf_complex_hundredthousand:n #1
 {
  \int_compare:nTF { \int_mod:nn { #1 } { 1000000 } = 0 }
   { \__turksuf_complex_million:n { #1 } }
   { 'da }
 }

现在测试文档可以

\documentclass{article}
\usepackage[turkish]{babel}
\usepackage{multicol}
\usepackage{turkref} % <--- load the package

\ExplSyntaxOn
% Just for testing not needed in real documents
\NewDocumentCommand\test{m}
 {
  \int_step_inline:nnnn { 0 } { 1 } { #1 }
   { ##1\turkishsuffix{##1}\par }
 }
\ExplSyntaxOff

\setlength{\parindent}{0pt} % just for the test

\begin{document}
\begin{multicols}{5}
\test{300}
\end{multicols}

\setcounter{figure}{12}
\begin{figure}
\caption{X}\label{A}
\end{figure}
\figurename~\turkishref{A}.

1234\turkishsuffix{1234}\\
1320\turkishsuffix{1320}\\
1330\turkishsuffix{1330}\\
1000\turkishsuffix{1000}\\
1003\turkishsuffix{1003}

\setcounter{section}{1}
\setcounter{subsection}{3}
\subsection{B}\label{B}

Subsection~\turkishref{B}

\end{document}

答案2

这会对包进行调整fmtcount并提供语言的数字序数turkish

首先,将以下代码另存为fc-turkish.tex(例如,名称无所谓)。包内的官方名称fmtcount可能会有所不同,但我不想使用官方名称,因为这不是包的官方文件。

\makeatletter
\def\@OT@do#1#2#3#4#5#6#7\@OT@enddo{%
\ifcase0#1 % ~0
  \ifx\relax#2\relax% 0
    \def\@OT@suf{da}%
  \else
    \ifcase#2 % ~00
      \ifx0#3% ~000
        \ifx0#4% ~0000
          \ifx0#5% ~00000
            \ifx0#6% ~000000
              \def\@OT@suf{da}%
            \else % ~x00000
              \def\@OT@suf{de}%
            \fi
          \else % ~x0000
            \def\@OT@suf{de}%
          \fi
        \else % ~x000
          \def\@OT@suf{de}%
        \fi
      \else % ~x00
        \def\@OT@suf{de}%
      \fi
    \or% ~10
      \def\@OT@suf{da}%
    \or% ~20
      \def\@OT@suf{de}%
    \or% ~30
      \def\@OT@suf{da}%
    \or% ~40
      \def\@OT@suf{da}%
    \or% ~50
      \def\@OT@suf{de}%
    \or% ~60
      \def\@OT@suf{da}%
    \or% ~70
      \def\@OT@suf{de}%
    \or% ~80
      \def\@OT@suf{de}%
    \or% ~90
      \def\@OT@suf{da}%
    \fi
  \fi
\or% ~1
  \def\@OT@suf{de}%
\or% ~2
  \def\@OT@suf{de}%
\or% ~3
  \def\@OT@suf{te}%
\or% ~4
  \def\@OT@suf{te}%
\or% ~5
  \def\@OT@suf{te}%
\or% ~6
  \def\@OT@suf{da}%
\or% ~7
  \def\@OT@suf{de}%
\or% ~8
  \def\@OT@suf{de}%
\or% ~9
  \def\@OT@suf{da}%
\fi
}
\def\@OT@rev#1#2\revA#3\revB{%
  \if\relax\detokenize{#2}\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi{#1#3}{\@OT@rev#2\revA#1#3\revB}}
\newcommand{\@ordinalMturkish}[1]{%
  \@orgargctr=#1\relax
  \@ordinalctr=#1%
  \edef\@OT@str{\the\@ordinalctr}%
  \edef\@OT@str{\expandafter\@OT@rev\@OT@str\revA\revB}%
  \expandafter\@OT@do\@OT@str\relax\relax\relax\relax\relax\relax\@OT@enddo
  \the\@orgargctr\fmtord{'\@OT@suf}%
}
\def\ordref#1{%
  \edef\@OD@ref{\csname r@#1\endcsname\relax}%
  \edef\@OD@num{\expandafter\@firstoftwo\@OD@ref}%
  \ifx\@OD@num\relax
    \@orgargctr0%
  \else
    \expandafter\@orgargctr0\@OD@num
  \fi
  \@ordinalMturkish\@orgargctr
}
\let\@ordinalFturkish=\@ordinalMturkish
\makeatother

然后,您就可以使用该包fmtcountturkish。测试文档:

\documentclass[12pt, oneside]{article}
\usepackage[turkish]{babel}
\usepackage[level]{fmtcount}
\input{fc-turkish.tex}
\def\fmtord#1{#1}
\begin{document}

\ttfamily

\section{First}

\section{Hello World!}\label{sec2s}

In \ordref{sec2s} section, there is a test of package functionality:

\raggedright\ttfamily

\ordinal{section}
\loop
\ifnum\value{section}<1000
\refstepcounter{section}
\ordinal{section}
\repeat

\loop
\ifnum\value{section}<100000
\addtocounter{section}{1030}
\ordinal{section}
\repeat

\setcounter{section}{0}

\loop
\ifnum\value{section}<1000000
\addtocounter{section}{100000}
\ordinal{section}
\repeat

\end{document}

很抱歉没有注释代码。我其实不确定该如何注释。部分取自fc-english.def,另一部分是一堆测试以获得正确的后缀。只有一点小提示:宏\OT@do输入要排版的数字,但写反了,所以最低有效位是#1。宏\ordref不适用于嵌套数字(2可以,2.4不可以)。

答案3

这是新手解决问题的方法(新手就是我)。它不使用 LaTeX3。它处理更多后缀类型。我把它做成了一个简单的包。它需要包etoolbox、、和xparsexstringrefcount

包装上的使用说明reftr

reftr package replaces \ref command by default. 
If you don't want this behaviour simply comment the last line of the package.
Then you will have to use \reftr command for suffixed cross references.
This package should also work with composite numbers (such as "2.12").

reftr package also defines \trnumdecorator macro for suffixing numbers.

Usage of \ref (or \reftr if not replaced):

To produce only the label number (original \ref behavior):
\ref{(label name)} 

To produce label number with a suffix:
\ref{label name}{suffix}

suffix should be defined as if it was for number "1". Allowed suffixes are:
 - de
 - den
 - e
 - i
 - in

Examples (assuming the figure with label "fig:figure3" is the third figure):

\ref{fig:figure3}       %This will output "3"
\ref{fig:figure3}{de}   %This will output "3'te"
\ref{fig:figure3}{den}  %This will output "3'ten"
\ref{fig:figure3}{e}    %This will output "3'e"
\ref{fig:figure3}{i}    %This will output "3'ü"
\ref{fig:figure3}{in}   %This will output "3'ün"

Errors:

If \ref{}{} comes accross a number that it can't handle it will produce "3'??"
If a wrong suffix is input it will produce "'?unknwnSfx"

\ref{fig:figure3}{ün} %This will output "3'?unknwnSfx"

Usage of \trnumdecorator:

\trnumdecorator{argument-that-ends-with-number}{suffix}

suffix should be defined as if it was for number "1". Allowed suffixes are:
 - de
 - den
 - e
 - i
 - in

The stared version \trnumdecorator* will only produce the suffix

Example:

\trnumdecorator{blabla20}{in}   %This will output "blabla20'nin"
\trnumdecorator*{blabla20}{in}  %This will output "'nin"

Note: \trnumdecorator* is what \ref uses for suffixing numbers

包裹代码

不要对我太苛刻,我是个新手

\ProvidesPackage{reftr}


\RequirePackage{etoolbox}
\RequirePackage{xparse}
\RequirePackage{xstring}
\RequirePackage{refcount}

\csdef{trsuf1de}{de}
\csdef{trsuf2de}{de}
\csdef{trsuf3de}{te}
\csdef{trsuf4de}{te}
\csdef{trsuf5de}{te}
\csdef{trsuf6de}{da}
\csdef{trsuf7de}{de}
\csdef{trsuf8de}{de}
\csdef{trsuf9de}{da}
\csdef{trsuf10de}{da}
\csdef{trsuf20de}{de}
\csdef{trsuf30de}{da}
\csdef{trsuf40de}{ta}
\csdef{trsuf50de}{de}
\csdef{trsuf60de}{ta}
\csdef{trsuf70de}{te}
\csdef{trsuf80de}{de}
\csdef{trsuf90de}{da}
\csdef{trsuf100de}{de}
\csdef{trsuf1000de}{de}

\csdef{trsuf1den}{den}
\csdef{trsuf2den}{den}
\csdef{trsuf3den}{ten}
\csdef{trsuf4den}{ten}
\csdef{trsuf5den}{ten}
\csdef{trsuf6den}{dan}
\csdef{trsuf7den}{den}
\csdef{trsuf8den}{den}
\csdef{trsuf9den}{dan}
\csdef{trsuf10den}{dan}
\csdef{trsuf20den}{den}
\csdef{trsuf30den}{dan}
\csdef{trsuf40den}{tan}
\csdef{trsuf50den}{den}
\csdef{trsuf60den}{tan}
\csdef{trsuf70den}{ten}
\csdef{trsuf80den}{den}
\csdef{trsuf90den}{dan}
\csdef{trsuf100den}{den}
\csdef{trsuf1000den}{den}

\csdef{trsuf1e}{e}
\csdef{trsuf2e}{ye}
\csdef{trsuf3e}{e}
\csdef{trsuf4e}{e}
\csdef{trsuf5e}{e}
\csdef{trsuf6e}{ya}
\csdef{trsuf7e}{ye}
\csdef{trsuf8e}{e}
\csdef{trsuf9e}{a}
\csdef{trsuf10e}{a}
\csdef{trsuf20e}{ye}
\csdef{trsuf30e}{a}
\csdef{trsuf40e}{a}
\csdef{trsuf50e}{ye}
\csdef{trsuf60e}{a}
\csdef{trsuf70e}{e}
\csdef{trsuf80e}{e}
\csdef{trsuf90e}{a}
\csdef{trsuf100e}{e}
\csdef{trsuf1000e}{e}

\csdef{trsuf1i}{i}
\csdef{trsuf2i}{yi}
\csdef{trsuf3i}{ü}
\csdef{trsuf4i}{ü}
\csdef{trsuf5i}{i}
\csdef{trsuf6i}{yı}
\csdef{trsuf7i}{yi}
\csdef{trsuf8i}{i}
\csdef{trsuf9i}{u}
\csdef{trsuf10i}{u}
\csdef{trsuf20i}{yi}
\csdef{trsuf30i}{u}
\csdef{trsuf40i}{ı}
\csdef{trsuf50i}{yi}
\csdef{trsuf60i}{ı}
\csdef{trsuf70i}{i}
\csdef{trsuf80i}{i}
\csdef{trsuf90i}{ı}
\csdef{trsuf100i}{ü}
\csdef{trsuf1000i}{i}

\csdef{trsuf1in}{in}
\csdef{trsuf2in}{nin}
\csdef{trsuf3in}{ün}
\csdef{trsuf4in}{ün}
\csdef{trsuf5in}{in}
\csdef{trsuf6in}{nın}
\csdef{trsuf7in}{nin}
\csdef{trsuf8in}{in}
\csdef{trsuf9in}{un}
\csdef{trsuf10in}{un}
\csdef{trsuf20in}{nin}
\csdef{trsuf30in}{un}
\csdef{trsuf40in}{ın}
\csdef{trsuf50in}{nin}
\csdef{trsuf60in}{ın}
\csdef{trsuf70in}{in}
\csdef{trsuf80in}{in}
\csdef{trsuf90in}{ın}
\csdef{trsuf100in}{ün}
\csdef{trsuf1000in}{in}

\NewDocumentCommand \trnumdecorator {s m m}{%
    \IfBooleanTF {#1}{}{#2}%
    \csdef{rtLstDgt}{?}%    
    \IfEndWith{#2}{1}{\csdef{rtLstDgt}{1}}{}%
    \IfEndWith{#2}{2}{\csdef{rtLstDgt}{2}}{}%
    \IfEndWith{#2}{3}{\csdef{rtLstDgt}{3}}{}%
    \IfEndWith{#2}{4}{\csdef{rtLstDgt}{4}}{}%
    \IfEndWith{#2}{5}{\csdef{rtLstDgt}{5}}{}%
    \IfEndWith{#2}{6}{\csdef{rtLstDgt}{6}}{}%
    \IfEndWith{#2}{7}{\csdef{rtLstDgt}{7}}{}%
    \IfEndWith{#2}{8}{\csdef{rtLstDgt}{8}}{}%
    \IfEndWith{#2}{9}{\csdef{rtLstDgt}{9}}{}%
    \IfEndWith{#2}{10}{\csdef{rtLstDgt}{10}}{}%
    \IfEndWith{#2}{20}{\csdef{rtLstDgt}{20}}{}%
    \IfEndWith{#2}{30}{\csdef{rtLstDgt}{30}}{}%
    \IfEndWith{#2}{40}{\csdef{rtLstDgt}{40}}{}%
    \IfEndWith{#2}{50}{\csdef{rtLstDgt}{50}}{}%
    \IfEndWith{#2}{60}{\csdef{rtLstDgt}{60}}{}%
    \IfEndWith{#2}{70}{\csdef{rtLstDgt}{70}}{}%
    \IfEndWith{#2}{80}{\csdef{rtLstDgt}{80}}{}%
    \IfEndWith{#2}{90}{\csdef{rtLstDgt}{90}}{}%
    \IfEndWith{#2}{00}{\csdef{rtLstDgt}{100}}{}%
    \IfEndWith{#2}{000}{\csdef{rtLstDgt}{1000}}{}%
    %\IfEq{\csuse{rtLstDgt}}{?}{'??}{'\csuse{trsuf\csuse{rtLstDgt}#3}}%Comment the line below and uncomment this one if you don't want ?unknwnSfx to be produced
    \IfEq{\csuse{rtLstDgt}}{?}{'??}{'\ifcsdef{trsuf\csuse{rtLstDgt}#3}    {\csuse{trsuf\csuse{rtLstDgt}#3}}{?unknwnSfx}}%       
}%

\let\oldref=\ref %this is added to allow converting \ref into \reftr

\NewDocumentCommand \reftr {m g}{%
    \oldref{#1}%
    \IfNoValueTF{#2}{}{%
        \trnumdecorator*{\getrefnumber{#1}}{#2}%        
    }%
}%

\let\ref=\reftr %this line makes \ref work as \reftr

答案4

这是@egreg 的回答zref利用(through )的灵活性zref-clever,这样就无需使用专用的引用命令。我们构建一个zref包含后缀的属性,然后就可以像其他任何属性一样进行引用。(使用标准引用命令的所有好处)。

\documentclass{article}

\usepackage[turkish]{babel}
\usepackage{turkref} % by 'egreg': https://tex.stackexchange.com/a/98366/105447

\usepackage{zref-clever}
\zcDeclareLanguage{turkish}
\zcLanguageSetup{turkish}{
  type=section,
    name-sg=Bölüm, % ???
  type=figure,
    name-sg=Şekil, % ???
}

% creating the reference property
\makeatletter
\zref@newprop{turkishref}{%
  \@currentlabel\turkishsuffix{\arabic{\@currentcounter}}}
\zref@addprop{main}{turkishref}
\makeatother

% Set default ref property to turkishref
\zcsetup{ref=turkishref}

\begin{document}

\setcounter{figure}{6}
\begin{figure}
\caption{X}
\zlabel{A}
\end{figure}

\setcounter{section}{1}
\setcounter{subsection}{14}
\subsection{B}
\zlabel{B}

\zcref{A}

\zcref{B}

\end{document}

在此处输入图片描述

相关内容