texlive[48606] Master/texmf-dist: bxorigcapt (6sep18)
commits+karl at tug.org
commits+karl at tug.org
Thu Sep 6 22:46:58 CEST 2018
Revision: 48606
http://tug.org/svn/texlive?view=revision&revision=48606
Author: karl
Date: 2018-09-06 22:46:58 +0200 (Thu, 06 Sep 2018)
Log Message:
-----------
bxorigcapt (6sep18)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/bxorigcapt/LICENSE
trunk/Master/texmf-dist/doc/latex/bxorigcapt/README.md
trunk/Master/texmf-dist/tex/latex/bxorigcapt/bxorigcapt.sty
Modified: trunk/Master/texmf-dist/doc/latex/bxorigcapt/LICENSE
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxorigcapt/LICENSE 2018-09-06 20:46:44 UTC (rev 48605)
+++ trunk/Master/texmf-dist/doc/latex/bxorigcapt/LICENSE 2018-09-06 20:46:58 UTC (rev 48606)
@@ -1,6 +1,6 @@
The MIT License
-Copyright (c) 2017 Takayuki YATO (aka. "ZR")
+Copyright (c) 2017-2018 Takayuki YATO (aka. "ZR")
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Modified: trunk/Master/texmf-dist/doc/latex/bxorigcapt/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxorigcapt/README.md 2018-09-06 20:46:44 UTC (rev 48605)
+++ trunk/Master/texmf-dist/doc/latex/bxorigcapt/README.md 2018-09-06 20:46:58 UTC (rev 48606)
@@ -6,6 +6,8 @@
This package forces the caption names (`\chaptername`, `\today`, etc)
declared by the document class in use to be used as the caption names
for a specific language introduced by the Babel package.
+
+Starting from version 0.3, this package also supports Polyglossia.
### System requirement
@@ -12,7 +14,7 @@
* TeX format: LaTeX.
* TeX engine: Anything.
* Dependent packages:
- - babel
+ - babel or polyglossia
### Installation
@@ -71,6 +73,8 @@
Revision History
----------------
+ * Version 0.3 〈2018/09/05〉
+ - Add support for Polyglossia.
* Version 0.2a 〈2017/05/03〉
- Minor fix.
* Version 0.2 〈2016/04/01〉
Modified: trunk/Master/texmf-dist/tex/latex/bxorigcapt/bxorigcapt.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bxorigcapt/bxorigcapt.sty 2018-09-06 20:46:44 UTC (rev 48605)
+++ trunk/Master/texmf-dist/tex/latex/bxorigcapt/bxorigcapt.sty 2018-09-06 20:46:58 UTC (rev 48606)
@@ -1,7 +1,7 @@
%%
%% This is file 'bxorigcapt.sty'.
-%%
-%% Copyright (c) 2017 Takayuki YATO (aka. "ZR")
+%%
+%% Copyright (c) 2017-2018 Takayuki YATO (aka. "ZR")
%% GitHub: https://github.com/zr-tex8r
%% Twitter: @zr_tex8r
%%
@@ -10,21 +10,25 @@
%% package declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bxorigcapt}[2017/05/03 v0.2a]
+\ProvidesPackage{bxorigcapt}[2018/09/05 v0.2a]
\def\bxoc at pkgname{bxorigcapt}
\providecommand*\bxDebug[1]{}
%% code guard
\edef\bxoc at restore@codes{%
+\catcode33=\the\catcode33%
\catcode39=\the\catcode39%
\catcode46=\the\catcode46%
\catcode47=\the\catcode47%
\catcode58=\the\catcode58%
+\catcode63=\the\catcode63%
\relax}
+\catcode33=12 % <!>
\catcode39=12 % <'>
\catcode46=12 % <.>
\catcode47=12 % </>
\catcode58=12 % <:>
+\catcode63=12 % <?>
\AtEndOfPackage{%
\bxoc at restore@codes
\let\bxoc at restore@codes\relax}
@@ -41,8 +45,37 @@
% dispatch
\ProcessOptions*
+%--------------------------------------- environment
+
+%% switch 'bxoc at polyglossia@available'
+\newif\ifbxoc at polyglossia@available
+\begingroup
+ \@tempswafalse
+ % engine check
+ \def\bxoc at next#1{%
+ \edef\bxoc at tmpa{\string#1}\edef\bxoc at tmpb{\meaning#1}%
+ \ifx\bxoc at tmpa\bxoc at tmpb \@tempswatrue \fi
+ }
+ \bxoc at next\XeTeXversion
+ \bxoc at next\luatexversion
+ % file check
+ \if at tempswa
+ \IfFileExists{polyglossia.sty}{}{\@tempswafalse}
+ \IfFileExists{etoolbox.sty}{}{\@tempswafalse}
+ \fi
+ \if at tempswa
+ \bxDebug{Polyglossia might be loaded}
+ \global\bxoc at polyglossia@availabletrue
+ \fi
+\endgroup
+
%--------------------------------------- general
+%% packages
+\ifbxoc at polyglossia@available
+ \RequirePackage{etoolbox}\relax
+\fi
+
%% \bxoc at name@list
% The list of caption names.
\@onlypreamble\bxoc at name@list
@@ -67,22 +100,73 @@
%--------------------------------------- hook
+%% \bxoc at check@conflict
+% Check if both babel and polyglossia are loaded, and then
+% annihilate all the function of this package.
+\@onlypreamble\bxoc at check@conflict
+\def\bxoc at check@conflict{%
+ \@ifpackageloaded{polyglossia}{%
+ %NB. polyglossia marks babel as loaded.
+ \@ifpackageloaded{babel}{%
+ \ifx\bbl at afterelse\@undefined\else % Babel is REALLY loaded
+ \PackageError\bxoc at pkgname
+ {Both Babel and Polyglossia are loaded!\MessageBreak
+ Such usage is not supported}%
+ {All the function of \bxoc at pkgname\space
+ is invalidated.\MessageBreak\@ehc}%
+ % annihilate
+ \let\bxoc at babel@hook\relax
+ \let\bxoc at check@conflict\relax
+ \fi
+ }{}%
+ }{}%
+}
+
+%% \bxoc at if@babel at or@polyglossia at loaded
+\@onlypreamble\bxoc at if@babel at or@polyglossia at loaded
+\def\bxoc at if@babel at or@polyglossia at loaded{%
+ \let\bxoc at next\@secondoftwo
+ \@ifpackageloaded{babel}{\let\bxoc at next\@firstoftwo}{}%
+ \@ifpackageloaded{polyglossia}{\let\bxoc at next\@firstoftwo}{}%
+ \bxoc at next
+}
+
%% \bxoc at babel@hook
% Note that \bxoc at babel@hook must be invoked between the loading
% of babel and the dispatch of babel's begin-document hook.
\@onlypreamble\bxoc at babel@hook
\let\bxoc at babel@hook\@empty
-\@ifpackageloaded{babel}{%
- \AtEndOfPackage{\bxoc at babel@hook}%
-}{%else
- \AtBeginDocument{%
- \@ifpackageloaded{babel}{%
+\bxoc at if@babel at or@polyglossia at loaded{%
+ \ifbxoc at polyglossia@available
+ \AtEndPreamble{%
+ \bxoc at check@conflict
\bxoc at babel@hook
- }{%else
- \PackageWarning\bxoc at pkgname
- {Babel is not loaded,}%
}%
- }%
+ \else
+ \AtEndOfPackage{\bxoc at babel@hook}%
+ \fi
+}{%else
+ \ifbxoc at polyglossia@available
+ \AtEndPreamble{%
+ \bxoc at if@babel at or@polyglossia at loaded{%
+ \bxoc at check@conflict
+ \bxoc at babel@hook
+ }{%else
+ \PackageWarning\bxoc at pkgname
+ {Neither Polyglossia nor Babel is\MessageBreak
+ loaded,}%
+ }%
+ }%
+ \else
+ \AtBeginDocument{%
+ \@ifpackageloaded{babel}{%
+ \bxoc at babel@hook
+ }{%else
+ \PackageWarning\bxoc at pkgname
+ {Babel is not loaded,}%
+ }%
+ }%
+ \fi
}
%--------------------------------------- deprecated ldf stuffs
@@ -145,7 +229,18 @@
\@onlypreamble\bxoc at enable@restore
\def\bxoc at enable@restore{%
\ifx\bxoc at target@lang\relax
- \let\bxoc at target@lang\bbl at main@language
+ \@ifpackageloaded{polyglossia}{%
+ \let\bxoc at target@lang\xpg at main@language
+ }{%else
+ \let\bxoc at target@lang\bbl at main@language
+ }%
+ \ifx\bxoc at target@lang\@undefined
+ \PackageError\bxoc at pkgname
+ {The main language is not set}%
+ {\@ehc}%
+ \def\bxoc at target@lang{?bxoc}
+ \@namedef{date\bxoc at target@lang}{}%
+ \fi
\fi
\bxDebug{target=\bxoc at target@lang}%
\expandafter\ifx\csname date\bxoc at target@lang\endcsname\relax
More information about the tex-live-commits
mailing list