Created
October 2, 2019 13:34
-
-
Save zr-tex8r/c7c0fd0f904596cf0e7acf72f5f94c5b to your computer and use it in GitHub Desktop.
LaTeX: To refuse (u)pTeX and show an essential-esque error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% | |
%% This is file 'dcnoptex.sty'. | |
%% | |
%% Copyright (c) 2019 Takayuki YATO (aka. "ZR") | |
%% GitHub: https://github.com/zr-tex8r | |
%% Twitter: @zr_tex8r | |
%% | |
%% This package is distributed under the MIT License. | |
%% | |
%% package declarations | |
\NeedsTeXFormat{LaTeX2e} | |
\RequirePackage{expl3,xparse} | |
\ProvidesExplPackage{dcnoptex}{2019/10/01}{0.2}{quack} | |
\str_const:Nn \c_dcnoptex_pkgname { dcnoptex } | |
%--------------------------------------- main | |
\bool_if:nTF | |
{ | |
\sys_if_engine_luatex_p: | |
|| \sys_if_engine_pdftex_p: | |
|| \sys_if_engine_xetex_p: | |
} | |
{ | |
\NewDocumentCommand \dcnoptexCheck { m } { } | |
} | |
{%>>> | |
\NewDocumentCommand \dcnoptexCheck { m } | |
{ | |
\msg_new:nnnn { #1 } { incompatible } | |
{ | |
The~#1~package~is~currently~only~compatible~with~ | |
pdfTeX,~LuaTeX,~and~XeTeX! | |
} | |
{ | |
\ ~_____________________________\\ | |
\ (Quack!~Sorry~for~that.~Quack!)\\ | |
\ ~"""""""""""""""""""""""""""""\\ | |
\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ \ ~\ ~\ ~\ ~\string\ \\ | |
\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ \ ~\ ~\ ~\ ~\ ~>()_\\ | |
\ \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ \ ~\ ~\ ~\ ~\ ~\ ~(__)__ | |
} | |
\msg_error:nn { #1 } { incompatible } | |
} | |
\endinput | |
}%<<< | |
%--------------------------------------- done | |
\endinput | |
%% EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For LaTeX package developers who can not read Japanese, it is nearly impossible to provide support for the (u)pTeX engines to the packages they are creating, maily because the (u)pTeX community will not provide any information on the engines in English. Thus it is rather sensible to refuse the (u)pTeX engines in advance and throw an error message when they are used.
Just insert the following code in your great LaTeX package:
That's all.