Skip to content

Commit

Permalink
Unset chinese and japanese captions on language termination
Browse files Browse the repository at this point in the history
Also fix some spacing issues
  • Loading branch information
jspitz committed Sep 17, 2024
1 parent 3d36fb1 commit f456e25
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 14 deletions.
40 changes: 32 additions & 8 deletions tex/gloss-chinese.ldf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@
\SetLanguageAliasValues{chinese}{variant}{tw,traditional}


\providecommand*\presection{}
\providecommand*\presubsection{}
\providecommand*\presubsubsection{}
\providecommand*\postsection{}
\providecommand*\postsubsection{}
\providecommand*\postsubsubsection{}
\let\xpg@save@presection\presection
\let\xpg@save@presubsection\presubsection
\let\xpg@save@presubsubsection\presubsubsection
\let\xpg@save@postsection\postsection
\let\xpg@save@postsubsection\postsubsection
\let\xpg@save@postsubsubsection\postsubsubsection
\let\xpg@save@seccntformat\@seccntformat

\def\chinese@capsformat{%
\def\@seccntformat##1{%
\csname pre##1\endcsname%
Expand All @@ -98,6 +112,16 @@
\def\presubsubsection{第}%
}

\def\nochinese@capsformat{%
\let\presection\xpg@save@presection%
\let\presubsection\xpg@save@presubsection%
\let\presubsubsection\xpg@save@presubsubsection%
\let\postsection\xpg@save@postsection%
\let\postsubsection\xpg@save@postsubsection%
\let\postsubsubsection\xpg@save@postsubsubsection%
\let\@seccntformat\xpg@save@seccntformat%
}

\def\captionschinese{%
\ifchinese@traditional
\captions@chinese@traditional
Expand Down Expand Up @@ -295,26 +319,26 @@
\fi

\def\noextras@chinese{%
\chinese@capsformat%
\nochinese@spacing
\nochinese@capsformat%
\nochinese@spacing%
}

\def\blockextras@chinese{%
\chinese@capsformat%
\ifchinese@traditional
\chinese@traditional@spacing
\chinese@traditional@spacing%
\else
\chinese@simplified@spacing
\fi
\chinese@simplified@spacing%
\fi%
}

\def\inlineextras@chinese{%
\chinese@capsformat%
\ifchinese@traditional
\chinese@traditional@spacing
\chinese@traditional@spacing%
\else
\chinese@simplified@spacing
\fi
\chinese@simplified@spacing%
\fi%
}
% Based on contributions of Toru Inagaki, Norio Iwase, François Charette

36 changes: 30 additions & 6 deletions tex/gloss-japanese.ldf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
% BCP-47 compliant aliases
\setlanguagealias*{japanese}{ja}

\providecommand*\presection{}
\providecommand*\presubsection{}
\providecommand*\presubsubsection{}
\providecommand*\postsection{}
\providecommand*\postsubsection{}
\providecommand*\postsubsubsection{}
\let\xpg@save@presection\presection
\let\xpg@save@presubsection\presubsection
\let\xpg@save@presubsubsection\presubsubsection
\let\xpg@save@postsection\postsection
\let\xpg@save@postsubsection\postsubsection
\let\xpg@save@postsubsubsection\postsubsubsection
\let\xpg@save@seccntformat\@seccntformat

\def\japanese@capsformat{%
\def\@seccntformat##1{%
\csname pre##1\endcsname%
Expand All @@ -34,6 +48,16 @@
\def\presubsubsection{第}%
}

\def\nojapanese@capsformat{%
\let\presection\xpg@save@presection%
\let\presubsection\xpg@save@presubsection%
\let\presubsubsection\xpg@save@presubsubsection%
\let\postsection\xpg@save@postsection%
\let\postsubsection\xpg@save@postsubsection%
\let\postsubsubsection\xpg@save@postsubsubsection%
\let\@seccntformat\xpg@save@seccntformat%
}

\def\captionsjapanese{%
\def\refname{参考文献}%
\def\abstractname{概要}%
Expand Down Expand Up @@ -232,18 +256,18 @@
\fi

\def\noextras@japanese{%
\japanese@capsformat%
\nojapanese@spacing
\nojapanese@capsformat%
\nojapanese@spacing%
}

\def\blockextras@japanese{%
\japanese@capsformat%
\japanese@spacing
\japanese@capsformat%
\japanese@spacing%
}

\def\inlineextras@japanese{%
\japanese@capsformat%
\japanese@spacing
\japanese@capsformat%
\japanese@spacing%
}
% Based on contributions of Toru Inagaki, Norio Iwase, François Charette

0 comments on commit f456e25

Please sign in to comment.