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.

1 Answer 1

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}
2
  • 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, 2015 at 16:05
  • 3
    I knew it ;-). Only this could explain your error. But I could also confirm it by converting it in babelpad. Sep 6, 2015 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .