Created
January 21, 2022 13:47
-
-
Save zr-tex8r/ef5f55c08cd3fa92558183cbe8bb3983 to your computer and use it in GitHub Desktop.
TeX: Make the TeX error messages cute. (for LuaLaTeX)
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 'scluamessages.sty'. | |
%% | |
%% Copyright (c) 2022 Takayuki YATO (aka. "ZR") | |
%% GitHub: https://github.com/zr-tex8r | |
%% Twitter: @zr_tex8r | |
%% | |
%% This package is distributed under the MIT License. | |
%% | |
%% package declaration | |
\NeedsTeXFormat{LaTeX2e} | |
\ProvidesPackage{scluamessages}[2022/01/21 v0.2] | |
\def\sczlm@pkgname{scluamessages} | |
%--------------------------------------- Check environment | |
\RequirePackage{iftex} | |
\RequireLuaTeX | |
%--------------------------------------- Apply Lua hooks | |
\begingroup \catcode`\#=12 \catcode`\~=12 \catcode`\^=7 | |
\catcode`\^^\=0 \catcode10=12 \endlinechar=10 | |
\catcode32=12\catcode`\\=12{}^^\directlua{ | |
local message = [[ | |
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
____ | |
___HHHH _____ WOW! | |
/ . . \ |YEAH!| You've got a great TeX error!! | |
\ --- / |~~~~~ | |
V :#######: Y | |
\/ o*"*\/ | |
{ o } | |
\_______/ HURRAY!! | |
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::]] | |
luatexbase.add_to_callback("show_error_hook", function() | |
texio.write("", ".") | |
texio.write_nl("", message) | |
end, "improve TeX error messages") | |
}^^\endgroup% | |
%--------------------------------------- All done | |
\endinput | |
%% 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
%#!lualatex | |
\documentclass[a4paper]{article} | |
\usepackage{scluamessages}% NICE!!! | |
\begin{document} | |
This is a test. | |
\parbox{t}{6em}{Hello,\\\TeX\\world!} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment