summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/def/ctex-common.def
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/def/ctex-common.def')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/def/ctex-common.def22
1 files changed, 16 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/def/ctex-common.def b/Master/texmf-dist/tex/latex/ctex/def/ctex-common.def
index 88b0e26378d..3229c41c82d 100644
--- a/Master/texmf-dist/tex/latex/ctex/def/ctex-common.def
+++ b/Master/texmf-dist/tex/latex/ctex/def/ctex-common.def
@@ -7,9 +7,6 @@
% Load some extra packages
-\IfFileExists{expl3.sty}{%
- \RequirePackage{expl3}}{}
-
\RequirePackage{ifpdf}
\RequirePackage{ifxetex}
@@ -48,6 +45,18 @@
\csname #2#3\expandafter\endcsname
{\csname #1#3\endcsname}}
+% Set our hooks
+\let\CTEX@begindocumenthook\@empty
+\let\CTEX@enddocumenthook\@empty
+\let\CTEX@save@begindocumenthook\@begindocumenthook
+\let\CTEX@save@enddocumenthook\@enddocumenthook
+\def\@begindocumenthook{\CTEX@save@begindocumenthook\CTEX@begindocumenthook}
+\def\@enddocumenthook{\CTEX@enddocumenthook\CTEX@save@enddocumenthook}
+\def\AtBeginDocument{\g@addto@macro\CTEX@save@begindocumenthook}
+\def\AtEndDocument{\g@addto@macro\CTEX@save@enddocumenthook}
+\def\CTEX@AtBeginDocument{\g@addto@macro\CTEX@begindocumenthook}
+\def\CTEX@AtEndDocument{\g@addto@macro\CTEX@enddocumenthook}
+
% Select engine: xetex has the highest priority, if not,
% then try cct, otherwise we use traditional cjk.
@@ -72,7 +81,7 @@
\newcommand*\CTEXindent{\CTEXsetfont\parindent2\ccwd}
\newcommand*\CTEXnoindent{\parindent\z@}
\ifCTEX@indent
- \AtBeginDocument{\CTEXindent}
+ \CTEX@AtBeginDocument{\CTEXindent}
\fi
\def\CTEX@spaceChar{\hskip \f@size \p@}
\def\baselinestretch{1.3}
@@ -342,7 +351,7 @@
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\csname cc@#1\endcsname%
\expandafter{\reserved@a}}}
-\AtBeginDocument{%
+\CTEX@AtBeginDocument{%
\makeatletter%
\@ifundefined{CTEX@save@setcounter}{%
\let\CTEX@save@setcounter\setcounter%
@@ -393,6 +402,7 @@
% Put hyperref as bottom as possible, otherwise there may be page
% count issues
+\AtEndOfPackage{%
\ifCTEX@hyperref
\ifxetex
\RequirePackage{hyperref}
@@ -412,7 +422,7 @@
\fi
\fi
\hypersetup{colorlinks=true}
-\fi
+\fi}
\endinput