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.def39
1 files changed, 18 insertions, 21 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 3229c41c82d..5b2f0857341 100644
--- a/Master/texmf-dist/tex/latex/ctex/def/ctex-common.def
+++ b/Master/texmf-dist/tex/latex/ctex/def/ctex-common.def
@@ -7,6 +7,10 @@
% Load some extra packages
+\IfFileExists{expl3.sty}{%
+ \RequirePackage{expl3}}{}
+
+\RequirePackage{etoolbox}
\RequirePackage{ifpdf}
\RequirePackage{ifxetex}
@@ -45,18 +49,6 @@
\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.
@@ -81,7 +73,7 @@
\newcommand*\CTEXindent{\CTEXsetfont\parindent2\ccwd}
\newcommand*\CTEXnoindent{\parindent\z@}
\ifCTEX@indent
- \CTEX@AtBeginDocument{\CTEXindent}
+ \AtBeginDocument{\CTEXindent}
\fi
\def\CTEX@spaceChar{\hskip \f@size \p@}
\def\baselinestretch{1.3}
@@ -351,7 +343,7 @@
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\csname cc@#1\endcsname%
\expandafter{\reserved@a}}}
-\CTEX@AtBeginDocument{%
+\AtBeginDocument{%
\makeatletter%
\@ifundefined{CTEX@save@setcounter}{%
\let\CTEX@save@setcounter\setcounter%
@@ -402,27 +394,32 @@
% Put hyperref as bottom as possible, otherwise there may be page
% count issues
-\AtEndOfPackage{%
\ifCTEX@hyperref
+\providecommand\hypersetup[1]{%
+ \PassOptionsToPackage{#1}{hyperref}}
+\AtEndPreamble{%
+ \@ifpackageloaded{hyperref}{}{\RequirePackage{hyperref}}}
+\AtEndOfPackage{%
\ifxetex
- \RequirePackage{hyperref}
+ \hypersetup{xetex,unicode}
\else
\ifpdf % pdftex
- \RequirePackage[pdftex]{hyperref}
+ \hypersetup{pdftex}
\else % dvipdfmx
+ \hypersetup{dvipdfmx}
\ifCTEX@GBK
\AtBeginDvi{\special{pdf:tounicode GBK-EUC-UCS2}}
\fi
- \RequirePackage[dvipdfmx]{hyperref}
\fi
\ifCTEX@GBK
- \hypersetup{CJKbookmarks=true}
+ \hypersetup{CJKbookmarks}
\else
- \hypersetup{unicode=true}
+ \hypersetup{unicode}
\fi
\fi
\hypersetup{colorlinks=true}
-\fi}
+}
+\fi
\endinput