3

I'd like to redefine some special characters as macros. Essentially, I want to tell lualatex to execute some user-defined commands whenever encountering some special characters, such as á, ḿ, etc.

I've found this solution. http://www.tex.ac.uk/FAQ-activechars.html

\catcode`\z=\active
\def z{Yawn, I'm tired}%

Unfortunately I think it doesn't work for special characters. When I put á at where z is in the above code, I got the following error:

!Improper alphabetic constant.

Any suggestion? Please also help to add relevant tags.

6

Your á is not a single glyph but an a with a combining accent U+0301. With the proper glyph U+00E1 is works fine:

\documentclass{article}

\begin{document}
\catcode`\á =\active
\def á {Yawn, I'm tired}%
á 
\end{document}
  • Thank you @Ulrike Fischer. How did you find out that the á in my original post is an a with a combing accent? – Roshnii Sep 6 '15 at 16:05
  • 3
    I knew it ;-). Only this could explain your error. But I could also confirm it by converting it in babelpad. – Ulrike Fischer Sep 6 '15 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.