如何使用区域编号来设置页码、页脚等?

如何使用区域编号来设置页码、页脚等?

我是 LaTeX 的新手,想知道是否可以使用其他语言来设置页码(以及任何其他自动编号)。

我在这里读到:http://www.personal.ceu.hu/tex/pagestyl.htm

\pagenumbering

\pagenumbering{num_style}

Specifies the style of page numbers. Possible values of num_style are:

arabic: Arabic numerals
roman: Lowercase roman numerals
Roman: Uppercase roman numerals
alph: Lowercase letters
Alph: Uppercase letters 

但是有没有办法指定我自己的语言环境编号(高棉语,在我的情况下是柬埔寨的语言)?高棉语采用 Unicode,数字 1-10 如下:១ ២ ៣ ៤ ៥ ៦ ៧ ៨ ៩ ១០

如果可能的话,它可以在任何 LaTeX 发行版中运行还是只在某些发行版中运行?

经过一番寻找,我找到了泰语的解决方案:http://thailatex.wordpress.com/2010/07/12/thai-number-for-xetex/

也许可以用高棉语重写......

谢谢你的帮助,Nathan

答案1

下面是我迄今为止使用 XeLaTeX 引擎以高棉语排版 LaTeX 书籍的样本。

如果您的系统发现任何错误,请告诉我。谢谢。

%!TEX TS-program = xelatex  
%!TEX encoding = UTF-8 Unicode

\documentclass[a4paper,12pt,twoside]{book}

\usepackage[sumlimits]{amsmath}  
\usepackage{amssymb,amsthm} 

\usepackage{fontspec}  
\defaultfontfeatures{Script=khmr,Mapping=tex-text} % to support TeX conventions like ``---'' 
\newfontscript{Khmer}{khmr} 
\usepackage{xunicode}  
\usepackage{xltxtra}  
\usepackage{titlesec} 
\usepackage{titletoc} 
\usepackage{hyperref} 
\usepackage[title,page,titletoc]{appendix} 

\newcommand{\KhOS}{\fontspec[Script=Khmer,Scale=0.92]{Khmer OS}\selectfont} 
\newcommand{\KhOSML}{\fontspec[Script=Khmer]{Khmer OS Muol Light} \selectfont} 
%\newcommand{\KhMEF}{\fontspec[Script=Khmer]{Khmer MEF2} \selectfont} 

\setmainfont[Script=Khmer,Scale=0.95]{Khmer OS Battambang} 

%%%%%%% This macro is to produce khmer numbering by adopting the thai numbering method
\makeatletter  
\def\@khmernum#1{\expandafter\@@khmernum\number#1\@nil}  
\def\@@khmernum#1{%  
  \ifx#1\@nil  
  \else  
  \char\numexpr#1+"17E0\relax  
  \expandafter\@@khmernum\fi  
}  
%\def\khmercounter#1{\expandafter\@khmernum\csname c@#1\endcsname}  
\renewcommand\@arabic{\@khmernum} % to reset number in \arabic to \khmernum  
\makeatother  

\theoremstyle{plain}  
\newtheorem{theorem}{\KhOSML ទ្រឹស្ដីបទ}[chapter]   
\newtheorem{proposition}{\KhOSML សំណើ}[theorem]  
\newtheorem{corollary}{\KhOSML កូរ៉ូលែរ}[theorem] 

\theoremstyle{definition} 
\newtheorem{definition}{\KhOSML និយមន័យ}[chapter]%
\newtheorem{lemma}{\KhOSML ឡែម}[definition]%

\theoremstyle{remark} 
\newtheorem{remark}{\KhOSML សម្គាល់}%[theorem] 
\newtheorem{example}{\KhOSML  ឧទាហរណ៍}[chapter] 
\newtheorem{exercise}{\KhOSML លំហាត់}[chapter] 
\renewcommand{\figurename}{\KhOSML  រូប} 
\renewcommand{\proofname}{\KhOSML សម្រាយបញ្ជាក់} 

\renewcommand{\contentsname}{មាតិកា} 
\renewcommand{\indexname}{លិបិក្រម} 
\renewcommand{\chaptername}{ជំពូកទី} 
\renewcommand{\partname}{ផ្នែកទី} 
\renewcommand{\appendixname}{ជំពូកបន្ថែម} 
\renewcommand{\listfigurename}{បញ្ជីរូបភាព} 
\renewcommand{\listtablename}{បញ្ជីតារាង} 
\renewcommand{\appendixpagename}{\KhOSML ជំពូកបន្ថែម} 

%%%% to format part, chapter, section, subsection and subsubsection using titlesec package

\titleformat{\section}[block] 
{\large \KhOSML}{{\large\thesection}}{1em}{}

\titleformat{\subsection}[block] 
{\normalsize \KhOSML}{{\normalsize\thesubsection}}{1em}{}

\titleformat{\subsubsection}[block] 
{\normalsize\KhOSML }{{\normalsize\thesubsubsection}}{1em}{}

\titleformat{\chapter}[display] 
    {\Huge\KhOSML }{\filright\LARGE\normalfont\chaptername\ \thechapter}{2ex}         %sep
    {\filcenter} 

\titleformat{\part}[display] 
{\filcenter\LARGE\KhOSML}{{\large\partname\; \thepart}}{1em}{\thispagestyle{empty}}

\makeatletter 
%%% to set khmer calendar 
\renewcommand\today{\@khmernum\day\space-\space\ifcase\month\or 
  មករា\or កុម្ភៈ\or មិនា\or មេសា\or ឧសភា\or មិថុនា\or
  កក្កដា\or សីហា\or កញ្ញា\or តុលា\or វិច្ឆិកា\or ធ្នូ\fi
 \space-\space\@khmernum\year} 
 \makeatother 
%%%%%%%%%%


\title{\KhOSML ចំណងជើងសៀវភៅ} 
\author{ អ្នកនិពន្វ} 
\date{\today}

\XeTeXlinebreaklocale "khm" % allow line breaks 
\XeTeXlinebreakskip = 0pt plus 1pt minus 1pt % for line breakskip suitable for Khmer Unicode fonts 


\begin{document}
\setcounter{secnumdepth}{3} % counter for susubsection
\setcounter{tocdepth}{3} % to view susubsection in toc

\frontmatter

\maketitle

\tableofcontents

\listoffigures
\addcontentsline{toc}{chapter}{បញ្ជីរូបភាព}

\listoftables
\addcontentsline{toc}{chapter}{បញ្ជីតារាង}

\chapter{បុព្វកថា}

\mainmatter

\part{ចំណងជើងផ្នែក}

\chapter{ជំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}
\begin{align}
A^T x &= A^T\left[\lambda x_1 + (1-\lambda)x_2\right] \notag\\
&= \lambda A^T x_1 + (1-\lambda)A^T x_2 = 
\lambda b + (1-\lambda)b = b
\end{align}


\subsubsection{ផ្នែករង-រង}
We have ....

\begin{lemma}
ខ្លឹមសារ
\subsection{ផ្នែករង}
\begin{align}
A^T x &= A^T\left[\lambda x_1 + (1-\lambda)x_2\right] \notag\\
&= \lambda A^T x_1 + (1-\lambda)A^T x_2 = 
\lambda b + (1-\lambda)b = b
\end{align}
\end{lemma}

\begin{theorem}
ខ្លឹមសារ
\begin{align}
A^T x &= A^T\left[\lambda x_1 + (1-\lambda)x_2\right] \notag\\
&= \lambda A^T x_1 + (1-\lambda)A^T x_2 = 
\lambda b + (1-\lambda)b = b
\end{align}
\end{theorem}

\begin{corollary}
ខ្លឹមសារ
\end{corollary}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{proof}
ខ្លឹមសារ
\end{proof}

\begin{remark}
ខ្លឹមសារ
\end{remark}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

នេះ​គឺជា​អត្ថបទ​ធម្មតា​មួយ​ដែល​គ្នាន​អត្ថន័យ​អ្វី​ទាល់​តែ​សោះ​។ តែ​ទោះ​ជាយ៉ាង​ណា​ក៏​ដោយ​%
ក៏​ត្រូវ​បាន​គេ​សរសេរ​​ដើម្បី​បង្ហាញ​ពី​ការសរសេរ​អត្ថបទ​ជា​ភាសារ​ខ្មែរ​។

\chapter{ជំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}

\begin{lemma}
ខ្លឹមសារ
\end{lemma}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{corollary}
ខ្លឹមសារ
\end{corollary}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{proof}
ខ្លឹមសារ
\end{proof}

\begin{remark}
ខ្លឹមសារ
\end{remark}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}

\subsection{ផ្នែករង}

\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}

\subsection{ផ្នែករង}


\part{ចំណងជើងផ្នែក}

\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}

\subsection{ផ្នែករង}


\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}


\subsection{ផ្នែករង}

%%%%% to format appendix chapter
\titleformat{\chapter}[display]
    {\Huge\KhOSML }{\filright\LARGE\normalfont ជំពូក\ \thechapter}{2ex}       
    {}
%%%%%

\begin{appendices}
\chapter{ចំណងជើងជំពូកបន្ថែម}
The contents of appendix...
\section{ចំណងជើងផ្នែក}

\chapter{ចំណងជើងជំពូកបន្ថែម}
The contents of appendix...
\section{ចំណងជើងផ្នែក}

\end{appendices}


\end{document}

答案2

我不知道高棉语,因为我没有可用的高棉字体。但对于泰语,这里有一个简单的版本印刷泰语数字。该宏\thaicounter接收计数器名称作为参数,以及\thainumeral十进制(西方)形式的数字:

\documentclass[a4paper]{article}

\makeatletter
\def\@thainumber#1{\expandafter\@@thainumber\number#1\@nil}
\def\@@thainumber#1{%
  \ifx#1\@nil
  \else
  \char\numexpr#1+"E50\relax
  \expandafter\@@thainumber\fi}
\def\thaicounter#1{\expandafter\@thainumber\csname c@#1\endcsname}
\def\thainumeral#1{\@@thainumber#1\@nil}
\makeatother
\renewcommand{\thepage}{\thaicounter{page}}

\usepackage{fontspec}
\setmainfont{FreeSerif}

\newcounter{pippo}
\begin{document}

\setcounter{pippo}{1234567890}
\thaicounter{pippo} \thainumeral{1234567890}

\end{document}

对于高棉语,除了更改名称外,只需更改"E50"17E0(高棉语数字零的代码点)即可。不允许使用负值,扩展宏应该很容易。宏只需逐一扫描从计数器值或明确数字获得的数字,并通过将数字添加到来打印相应的符号"E50"

答案3

只需\pagenumbering{<style>}重置page计数器并重新定义\thepage使用内部宏\@<style>,并以当前页码作为\@arabic参数arabic

您可以手动重新定义\thepage为您选择的格式。您需要定义一个宏,将页码转换为其高棉表示形式,例如第 123 页(整数)必须转换为类似\khymernum{1}\khymernum{2}\khymernum{3}(其中\khymernum将是一个用于排版高棉数字的宏)。这应该适用于所有支持 Unicode(以某种方式)或可以以不同方式插入符号的发行版。我想说使用 XeLaTeX 更容易,但对于 PDFLaTeX 也应该可以(以某种方式)。

如果您希望它更加通用,您可以定义\khymer\@khymer,以便您(和其他人)可以说\pagenumbering{khymer}

答案4

非常感谢egreg

我终于做到了

\documentclass[a4paper]{book}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{blindtext}
\usepackage{fontspec}

\setmainfont[Script=Khmer]{Khmer OS}
\XeTeXlinebreaklocale "KHM"

\makeatletter
\def\@khmernumer#1{\expandafter\@@khmernumer\number#1\@nil}
\def\@@khmernumer#1{%
  \ifx#1\@nil
  \else
  \char\numexpr#1+"17E0\relax
  \expandafter\@@khmernumer\fi}
\def\khmercounter#1{\expandafter\@khmernumer\csname c@#1\endcsname}
\def\thainumeral#1{\@@khmernumer#1\@nil}
\makeatother

\def\contentsname{មាតិការ}
\def\partname{ផ្នែក}
\def\thepart{\khmercounter{part}}
\def\theequation{\khmercounter{equation}}
\def\chaptername{ជំពូក}
\def\thechapter{\khmercounter{chapter}}
\def\thesection{\khmercounter{section}}
\def\thesubsection{\khmercounter{section}.\khmercounter{subsection}}
\def\theenumi{\khmercounter{enumi}}
\def\thepage{\khmercounter{page}}
\newtheorem{theorem}{ទ្រឹស្ដីបទ}[chapter]
\newtheorem{lemma}[theorem]{បទគន្លឹះ}
\newtheorem{corollary}[theorem]{ស្វ័យស័ត្យ}
\newtheorem{remark}{សម្គាល់}[chapter]
\newtheorem{exercise}{លំហាត់}[chapter]
\def\theremark{\khmercounter{chapter}.\khmercounter{remark}}
\def\theexercise{\khmercounter{chapter}.\khmercounter{exercise}}
\def\thetheorem{\khmercounter{chapter}.\khmercounter{theorem}}
\def\proofname{សម្រាយ}

\begin{document}

\tableofcontents

\part{ចំណងជើងផ្នែក}

\chapter{ជំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}

\begin{lemma}
ខ្លឹមសារ
\end{lemma}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{corollary}
ខ្លឹមសារ
\end{corollary}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{proof}
ខ្លឹមសារ
\end{proof}

\begin{remark}
ខ្លឹមសារ
\end{remark}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

នេះ​គឺជា​អត្ថបទ​ធម្មតា​មួយ​ដែល​គ្នាន​អត្ថន័យ​អ្វី​ទាល់​តែ​សោះ​។ តែ​ទោះ​ជាយ៉ាង​ណា​ក៏​ដោយ​%
ក៏​ត្រូវ​បាន​គេ​សរសេរ​​ដើម្បី​បង្ហាញ​ពី​ការសរសេរ​អត្ថបទ​ជា​ភាសារ​ខ្មែរ​។

\chapter{ជំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}

\begin{lemma}
ខ្លឹមសារ
\end{lemma}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{corollary}
ខ្លឹមសារ
\end{corollary}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{theorem}
ខ្លឹមសារ
\end{theorem}

\begin{proof}
ខ្លឹមសារ
\end{proof}

\begin{remark}
ខ្លឹមសារ
\end{remark}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\begin{exercise}
ខ្លឹមសារ
\end{exercise}

\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}
\Blindtext
\Blindtext

\subsection{ផ្នែករង}
\Blindtext
\Blindtext

\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}
\Blindtext
\Blindtext

\subsection{ផ្នែករង}
\Blindtext
\Blindtext  

\part{ចំណងជើងផ្នែក}

\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}
\Blindtext
\Blindtext

\subsection{ផ្នែករង}
\Blindtext
\Blindtext  

\chapter{ចំណងជើងជំពូក}

\section{ផ្នែក}

\subsection{ផ្នែករង}

\Blindtext
\Blindtext

\subsection{ផ្នែករង}

\Blindtext
\Blindtext

\end{document}

参考

编号部分

相关内容