Skip to content

Instantly share code, notes, and snippets.

Last active Dec 19, 2018
What would you like to do?
LaTeX: To correct the engine detection of expl3 in using pLaTeX
% bxexpl3ptex.sty
%% package declaration
\ProvidesPackage{bxexpl3ptex}[2015/07/28 v0.3]
%% hack for \ifpdfprimitive
\expandafter\ifx\csname ifpdfprimitive\endcsname\relax
\else \expandafter\@gobble
\fi {%
%% do it
%--------------------------------------- adjustments
\cs_new_eq:NN \ptex_if_engine:T \use_none:n
\cs_new_eq:NN \ptex_if_engine:F \use:n
\cs_new_eq:NN \ptex_if_engine:TF \use_ii:nn
\cs_new_eq:NN \ptex_if_engine_p: \c_false_bool
\cs_new_eq:NN \uptex_if_engine:T \use_none:n
\cs_new_eq:NN \uptex_if_engine:F \use:n
\cs_new_eq:NN \uptex_if_engine:TF \use_ii:nn
\cs_new_eq:NN \uptex_if_engine_p: \c_false_bool
\str_if_eq_x:nnT { \token_to_meaning:N \kanjiskip }
{ \token_to_str:N \kanjiskip }
% I'm pTeX! The current judge is:
% pdftex_if_engine = true
% luatex_if_engine = false
% xetex_if_engine = false
\cs_gset_eq:NN \ptex_if_engine:T \use:n
\cs_gset_eq:NN \ptex_if_engine:F \use_none:n
\cs_gset_eq:NN \ptex_if_engine:TF \use_i:nn
\cs_gset_eq:NN \ptex_if_engine_p: \c_true_bool
% I'm not pdfTeX.
\cs_gset_eq:NN \pdftex_if_engine:T \use_none:n
\cs_gset_eq:NN \pdftex_if_engine:F \use:n
\cs_gset_eq:NN \pdftex_if_engine:TF \use_ii:nn
\cs_gset_eq:NN \pdftex_if_engine_p: \c_false_bool
\str_if_eq_x:nnT { \token_to_meaning:N \forcecjktokens }
{ \token_to_str:N \forcecjktokens }
% I'm upTeX!
\cs_gset_eq:NN \uptex_if_engine:T \use:n
\cs_gset_eq:NN \uptex_if_engine:F \use_none:n
\cs_gset_eq:NN \uptex_if_engine:TF \use_i:nn
\cs_gset_eq:NN \uptex_if_engine_p: \c_true_bool
%--------------------------------------- done
%% EOF
Copy link

zr-tex8r commented Nov 27, 2014


  • Load this package instead of expl3. This package loads internally expl3, passing all the given options.
  • If there is a package that internally loads expl3, then load this package before such package.

How to use the media9 package on pLaTeX + dvipdfmx:

\usepackage{bxexpl3ptex}% at the beginning of preamble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment