将章节标题中的“第 1 章”替换为“第一章”,但不影响 lof 和 lot

将章节标题中的“第 1 章”替换为“第一章”,但不影响 lof 和 lot

我使用了这里给出的答案将“第 1 章”替换为“第一章”,但不影响 lof 和 lot但它并没有像我想要的那样工作。我是一个打字报告类,我喜欢引用章节,并且不希望“第一章”出现在我在文本中引用它的地方,而是更喜欢“第 1 章”。

 \documentclass[a4paper,12]{report}
 \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} 
  \usepackage{amssymb,amsfonts,amsmath,graphicx,autobreak}
 \usepackage{changepage,mathtools,amsthm,tikz,blindtext}
 \usepackage{inputenc,float,caption,subcaption,enumitem}
 \usepackage[font=large,labelfont=bf,font=bf,labelsep=space]{caption}
 \usepackage[font=small,labelfont=bf,font=bf,labelsep=space]{subcaption}
 \usepackage{csquotes} %for single quoatation mark
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
 \linespread{1.5}
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
 \usepackage[authoryear]{natbib}
 \usepackage[]{color}
 \usepackage[english]{babel}
 % the below format chapter header
 \usepackage{titlesec}
 \usepackage[tracking=true]{microtype}
 \titleformat{\chapter}[display]
 {\centering\normalfont\huge\bfseries}
 {\filcenter{\MakeUppercase{\textls[400]
 {\chaptertitlename}}\ \thechapter}}{20pt}{\Huge}
 \usepackage{tocloft}
 \usepackage{fmtcount}
 \renewcommand{\bibname}{References}

 %%% fit Table 4.3 to page %%%%%
 \usepackage{adjustbox}
 \usepackage[section]{placeins}
 \usetikzlibrary{shapes.geometric,arrows}
 \renewcommand{\bibname}{REFERENCES}
 \DeclareMathOperator{\var}{\mathbb{V}ar}
 \DeclareMathOperator{\cov}{\mathbb{C}ov}
 \DeclareMathOperator{\expect}{\mathbb{E}}
 \DeclareMathOperator{\corr}{Corr}
 \DeclareMathOperator{\ARIMA}{\mathbb{ARIMA}}
 \DeclareMathOperator{\AR}{\mathbb{AR}}
 \DeclareMathOperator{\MA}{\mathbb{MA}}
 \DeclareMathOperator{\ARMA}{\mathbb{ARMA}}
 \DeclareMathOperator{\R}{\mathbb{R}}
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
 \linespread{1.5}
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
 \usepackage{amsmath}
 \usepackage[T1]{fontenc}
 \usepackage{lmodern}

 \def\bsq#1{%both single quotes
\lq{#1}\rq}
 %%%the below with \tag{\stepcounter{equation}\theequation}\\ in the 
 %document allow page brake for equation
 %\usepackage[b]{esvect} %
 %\allowdisplaybreaks

 % the below changes chapter 1 to chapter one
 \usepackage{xpatch}% http://ctan.org/pkg/etoolbox
 \usepackage{fmtcount}% http://ctan.org/pkg/fmtcount
 \renewcommand{\thechapter}{\NUMBERstring{chapter}}
 \renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
 \renewcommand\theequation{\arabic{equation}}
 \makeatletter
 \xpatchcmd{\@chapter}% <cmd>
 {\numberline{\thechapter}}% <search>
 {\@chapapp~\thechapter\quad}% <replace>
 {}{}% <success><failure>
 \makeatother

 \usepackage{afterpage}
 %to add page on top of page numbers in toc after its first page
 \usepackage{tocloft}


 % patch \@makechapterhead
 \usepackage{etoolbox}
 \makeatletter
 \patchcmd{\@makechapterhead}
  {\thechapter}
  {\NUMBERstring{chapter}}
  {}{}
  \makeatother
  \begin{document}

  \newpage\pagenumbering{arabic}
  \newpage
  \renewcommand\contentsname{\hfill Table of  Contents \hfil}
  \tableofcontents
  \addtocontents{toc}{~\hfill\textbf{Page}\par}
  \addtocontents{toc}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}%
  \newpage
  \listoftables
  \newpage
  \listoffigures
  \begin{abstract}
   \blindtext
  \end{abstract}

  \chapter{INTRODUCTION} \label{ch1}
  \section{Background of Study} \label{sc1}

 \begin{figure}[H]
 A
 \caption{A figure} \label{fg1}
 \end{figure}

 \begin{table}[H]
    \centering
    \caption{Table A}
    \label{tab1}
    \resizebox{\textwidth}{!}{%
 \begin{tabular}{|c|c|}
     \hline 
     \rule[-1ex]{0pt}{2.5ex} A & B \\ 
     \hline 
     \rule[-1ex]{0pt}{2.5ex} 1 & 2 \\ 
     \hline 
 \end{tabular}
  } 
\end{table}
 \section{Brief Overview of the study } \label{sc11}

 \begin{figure}[H]
    AA
    \caption{A figure} \label{fg11}
 \end{figure}

 \begin{table}[H]
    \centering
    \caption{Table AA}
    \label{tab11}
    \resizebox{\textwidth}{!}{%
        \begin{tabular}{|c|c|}
            \hline 
            \rule[-1ex]{0pt}{2.5ex} AA & BB \\ 
            \hline 
            \rule[-1ex]{0pt}{2.5ex} 11 & 22 \\ 
            \hline 
        \end{tabular}
    } 
 \end{table}
 \chapter{LITERATURE REVIEW} \label{ch2}
  \section{Introduction} \label{sc2}

 \begin{figure}[H]
 B
 \caption{B figure} \label{fg2}
 \end{figure}

 \begin{table}[H]
    \centering
    \caption{Table B}
    \label{tab2}
    \resizebox{\textwidth}{!}{%
 \begin{tabular}{|c|c|}
     \hline 
     \rule[-1ex]{0pt}{2.5ex} C & D \\ 
     \hline 
     \rule[-1ex]{0pt}{2.5ex} 3 & 4 \\ 
     \hline 
 \end{tabular}
 }
 \end{table} 

 \chapter{METHODOLOGY} \label{ch3}
  \section{Introduction} \label{sc3}

 \begin{figure}[H]
 C
 \caption{C figure} \label{fg3}
 \end{figure}

    \begin{table}[H]
    \centering
    \caption{Table C}
    \label{tab3}
    \resizebox{\textwidth}{!}{%
 \begin{tabular}{|c|c|}
     \hline 
     \rule[-1ex]{0pt}{2.5ex} E & F \\ 
     \hline 
     \rule[-1ex]{0pt}{2.5ex} 5 & 6 \\ 
     \hline 
 \end{tabular}
 }
 \end{table} 

 \chapter{CONCLUSION}
 \section{Introduction}
 I shall refer to Table \ref{tab1} of Section \ref{sc1} as well as Figure 
\ref{fg11} and Table \ref{tab11} of Section \ref{sc11} all in Chapter 
\ref{ch1} and Table \ref{tab2} of Section \ref{sc2} in Chapter \ref{ch3} 
which will show Figure \ref{fg3} of Section \ref{sc3} in Chapter \ref{ch3}
 \end{document}

它在您的 MWE 中运行,但是当我将它放在我自己的完整工作环境中时,它确实可以无错误运行,然而表格列表、图表列表和内联引用看起来就像所附的图片一样,正如您在运行我的 MWE 时所看到的那样。

在此处输入图片描述

图表列表如下

在此处输入图片描述

文中引用如下

在此处输入图片描述

我希望文中章节的引用带有阿拉伯数字,如“第 1 章”、“第 2 章”等,而章节标题编号以文字形式显示,如“第一章”、“第二章”等,并且章节的内联引用使用阿拉伯语而不是文字。

请帮我

答案1

根据需求引入一个新的计数器,即ONE,TWO,...,不修改\thechapter,例如,参考下面的代码:

 \documentclass[a4paper,12]{report}
 \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} 
  \usepackage{amssymb,amsfonts,amsmath,graphicx,autobreak}
 \usepackage{changepage,mathtools,amsthm,tikz,blindtext}
 \usepackage{inputenc,float,caption,subcaption,enumitem}
 \usepackage[font=large,labelfont=bf,font=bf,labelsep=space]{caption}
 \usepackage[font=small,labelfont=bf,font=bf,labelsep=space]{subcaption}
 \usepackage{csquotes} %for single quoatation mark
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
 \linespread{1.5}
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
\makeatletter%%Here is the counter introduced
\def\numinwords#1{\expandafter\@numinwords\csname c@#1\endcsname}
\def\@numinwords#1{%
  \ifcase#1\or ONE\or TWO\or THREE\or FOUR\or FIVE\or SIX\or SEVEN\else\@ctrerr\fi}
\makeatother
 \usepackage[authoryear]{natbib}
 \usepackage[]{color}
 \usepackage[english]{babel}
 % the below format chapter header
 \usepackage{titlesec}
 \usepackage[tracking=true]{microtype}
 \titleformat{\chapter}[display]
 {\centering\normalfont\huge\bfseries}
 {\filcenter{\MakeUppercase{\textls[400]
 {\chaptertitlename}}\ \numinwords{chapter} }}{20pt}{\Huge}
 \usepackage{tocloft}
 \usepackage{fmtcount}
 \renewcommand{\bibname}{References}

 %%% fit Table 4.3 to page %%%%%
 \usepackage{adjustbox}
 \usepackage[section]{placeins}
 \usetikzlibrary{shapes.geometric,arrows}
 \renewcommand{\bibname}{REFERENCES}
 \DeclareMathOperator{\var}{\mathbb{V}ar}
 \DeclareMathOperator{\cov}{\mathbb{C}ov}
 \DeclareMathOperator{\expect}{\mathbb{E}}
 \DeclareMathOperator{\corr}{Corr}
 \DeclareMathOperator{\ARIMA}{\mathbb{ARIMA}}
 \DeclareMathOperator{\AR}{\mathbb{AR}}
 \DeclareMathOperator{\MA}{\mathbb{MA}}
 \DeclareMathOperator{\ARMA}{\mathbb{ARMA}}
 \DeclareMathOperator{\R}{\mathbb{R}}
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
 \linespread{1.5}
 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
 \usepackage{amsmath}
 \usepackage[T1]{fontenc}
 \usepackage{lmodern}

 \def\bsq#1{%both single quotes
\lq{#1}\rq}
 %%%the below with \tag{\stepcounter{equation}\theequation}\\ in the 
 %document allow page brake for equation
 %\usepackage[b]{esvect} %
 %\allowdisplaybreaks

 % the below changes chapter 1 to chapter one
 \usepackage{xpatch}% http://ctan.org/pkg/etoolbox
 \usepackage{fmtcount}% http://ctan.org/pkg/fmtcount
% \renewcommand{\thechapter}{\NUMBERstring{chapter}}
 \renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
 \renewcommand\theequation{\arabic{equation}}
 \makeatletter
 \xpatchcmd{\@chapter}% <cmd>
 {\numberline{\thechapter}}% <search>
 {\@chapapp~\thechapter\quad}% <replace>
 {}{}% <success><failure>
 \makeatother

 \usepackage{afterpage}
 %to add page on top of page numbers in toc after its first page
 \usepackage{tocloft}


 % patch \@makechapterhead
 \usepackage{etoolbox}
 \makeatletter
 \patchcmd{\@makechapterhead}
  {\thechapter}
  {\NUMBERstring{chapter}}
  {}{}
  \makeatother
  \begin{document}

  \newpage\pagenumbering{arabic}
  \newpage
  \renewcommand\contentsname{\hfill Table of  Contents \hfil}
  \tableofcontents
  \addtocontents{toc}{~\hfill\textbf{Page}\par}
  \addtocontents{toc}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}%
  \newpage
  \listoftables
  \newpage
  \listoffigures
  \begin{abstract}
   \blindtext
  \end{abstract}

  \chapter{INTRODUCTION} \label{ch1}
  \section{Background of Study} \label{sc1}

 \begin{figure}[H]
 A
 \caption{A figure} \label{fg1}
 \end{figure}

 \begin{table}[H]
    \centering
    \caption{Table A}
    \label{tab1}
    \resizebox{\textwidth}{!}{%
 \begin{tabular}{|c|c|}
     \hline 
     \rule[-1ex]{0pt}{2.5ex} A & B \\ 
     \hline 
     \rule[-1ex]{0pt}{2.5ex} 1 & 2 \\ 
     \hline 
 \end{tabular}
  } 
\end{table}
 \section{Brief Overview of the study } \label{sc11}

 \begin{figure}[H]
    AA
    \caption{A figure} \label{fg11}
 \end{figure}

 \begin{table}[H]
    \centering
    \caption{Table AA}
    \label{tab11}
    \resizebox{\textwidth}{!}{%
        \begin{tabular}{|c|c|}
            \hline 
            \rule[-1ex]{0pt}{2.5ex} AA & BB \\ 
            \hline 
            \rule[-1ex]{0pt}{2.5ex} 11 & 22 \\ 
            \hline 
        \end{tabular}
    } 
 \end{table}
 \chapter{LITERATURE REVIEW} \label{ch2}
  \section{Introduction} \label{sc2}

 \begin{figure}[H]
 B
 \caption{B figure} \label{fg2}
 \end{figure}

 \begin{table}[H]
    \centering
    \caption{Table B}
    \label{tab2}
    \resizebox{\textwidth}{!}{%
 \begin{tabular}{|c|c|}
     \hline 
     \rule[-1ex]{0pt}{2.5ex} C & D \\ 
     \hline 
     \rule[-1ex]{0pt}{2.5ex} 3 & 4 \\ 
     \hline 
 \end{tabular}
 }
 \end{table} 

 \chapter{METHODOLOGY} \label{ch3}
  \section{Introduction} \label{sc3}

 \begin{figure}[H]
 C
 \caption{C figure} \label{fg3}
 \end{figure}

    \begin{table}[H]
    \centering
    \caption{Table C}
    \label{tab3}
    \resizebox{\textwidth}{!}{%
 \begin{tabular}{|c|c|}
     \hline 
     \rule[-1ex]{0pt}{2.5ex} E & F \\ 
     \hline 
     \rule[-1ex]{0pt}{2.5ex} 5 & 6 \\ 
     \hline 
 \end{tabular}
 }
 \end{table} 

 \chapter{CONCLUSION}
 \section{Introduction}
 I shall refer to Table \ref{tab1} of Section \ref{sc1} as well as Figure 
\ref{fg11} and Table \ref{tab11} of Section \ref{sc11} all in Chapter 
\ref{ch1} and Table \ref{tab2} of Section \ref{sc2} in Chapter \ref{ch3} 
which will show Figure \ref{fg3} of Section \ref{sc3} in Chapter \ref{ch3}
 \end{document}

相关内容