Created
July 8, 2019 08:36
-
-
Save wtsnjp/f5bc5780b2eaaf5cec09821573a1f377 to your computer and use it in GitHub Desktop.
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 'notexcode.sty'. | |
%% | |
%% Copyright 2019 Takuto ASAKURA (wtsnjp) | |
%% GitHub: https://github.com/wtsnjp | |
%% Twitter: @wtsnjp | |
%% | |
%% This package is distributed under the MIT License. | |
%% | |
% -------------------------------------------------- declarations | |
\RequirePackage{expl3} | |
\ProvidesExplPackage {notexcode} {2019/07/08} {0.1.0} | |
{Let's stop writing TeX macro language unconsciously} | |
% -------------------------------------------------- messages | |
\msg_new:nnn { notexcode } { primitive-found } | |
{ | |
There~is~a~TeX~primitive~\msg_line_context: :~\exp_not:N #1 | |
} | |
% -------------------------------------------------- imprementation | |
\cs_new:Npn \ntcd_notexcode:n #1 | |
{ | |
\tl_map_function:nN { #1 } \__ntcd_warn_if_primitive:N | |
\__ntcd_exec:n { #1 } | |
} | |
\cs_new:Npn \__ntcd_warn_if_primitive:N #1 | |
{ | |
\int_compare:nNnTF { \tl_count:n { #1 } } = { \c_one_int } | |
{ | |
\token_if_primitive:NT #1 | |
{ \msg_warning:nnn { notexcode } { primitive-found } { #1 } } | |
} | |
{ \tl_map_function:nN { #1 } \__ntcd_warn_if_primitive:N } | |
} | |
\cs_new:Npn \__ntcd_exec:n #1 { #1 } | |
% -------------------------------------------------- LaTeX2e interface | |
%% \notexcode { <code> } | |
\cs_new_eq:NN \notexcode \ntcd_notexcode:n | |
% vim: ft=expl3 nospell: | |
%% EOF |
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
\documentclass{article} | |
\usepackage{notexcode} | |
\notexcode{\newcommand{\foo}{foo}}% LaTeX code | |
\notexcode{\def\bar{bar}}% TeX code | |
\begin{document} | |
Hello {\foo} and {\bar}! | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Processing
test.tex
withwill show you a warning message which looks like
in your terminal and the log file.