Skip to content

Commit

Permalink
Use babel for CN/EN support
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinyu95 committed Nov 7, 2023
1 parent c03fdce commit e12f13e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 1 addition & 3 deletions algoxy-zh-cn.tex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@

\subimport{search/}{search-zh-cn.tex}

\renewcommand\appendixname{附录}
\appendix

\subimport{others/appendix/rbt-del/}{rbt-del-zh-cn.tex}
Expand All @@ -117,8 +116,7 @@ \chapter{参考答案}

\backmatter
\phantomsection
\addcontentsline{toc}{chapter}{索引}
\renewcommand\indexname{索引}
\addcontentsline{toc}{chapter}{\indexname}
\printindex

\end{document}
2 changes: 1 addition & 1 deletion others/appendix/bib-zh-cn.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\renewcommand\bibname{参考文献}
\markboth{\bibname}{}
\phantomsection % so hyperref creates bookmarks
\addcontentsline{toc}{chapter}{\bibname}

Expand Down
12 changes: 11 additions & 1 deletion prelude.sty
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
pdfstartview=FitH]{hyperref}

\usepackage{fontspec}
\usepackage[nil,english]{babel}
\usepackage{graphicx, color}
\usepackage{adjustbox}
\usepackage{wrapfig}
Expand Down Expand Up @@ -76,7 +77,7 @@
numberstyle=\ttfamily\tiny,
emphstyle={\bf},
escapeinside={*'}{'*},
stringstyle=\mdseries\rmfamily,
stringstyle=\mdseries\ttfamily, %rmfamily,
keywordstyle=\bfseries\ttfamily, %rmfamily
basicstyle=\footnotesize\ttfamily, %sffamily
commentstyle = \footnotesize\rmfamily,
Expand Down Expand Up @@ -279,6 +280,14 @@
% Simplified way to customize Chinese. Or \usepackage[chinese, english]{babel}
% However, it need install the additional texlive-lang-chinese.
\addto\captionsenglish{\renewcommand{\contentsname}{目录}}
\addto\captionsenglish{\renewcommand{\appendixname}{附录}}
\addto\captionsenglish{\renewcommand\bibname{参考文献}}
\addto\captionsenglish{\renewcommand\indexname{索引}}
\addto\captionsenglish{\renewcommand{\figurename}{图}}
\addto\captionsenglish{\renewcommand{\tablename}{表}}
\addto\captionsenglish{\renewcommand{\proofname}{证明}}
\newtheorem{axiom}{公理}[section]
\newtheorem{theorem}{定理}[section]
\newtheorem{lemma}[theorem]{引理}
Expand Down Expand Up @@ -307,6 +316,7 @@
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}{Definition}[section]
\newtheorem{example}{Example}[section]
\babelfont[chinese]{rm}{Noto Serif CJK SC}
}
\DeclareOption*{\PackageWarning{prelude}{Unknown ‘\CurrentOption’}}
Expand Down

0 comments on commit e12f13e

Please sign in to comment.