Context: I've inherited a mess of latex notes from another faculty member; these are processed by using a home-brew system that does lots of clever stuff ... but that means that I must work on them using the linux systems at the office, and also means that finding bugs ends up being a binary-search process, because the clever processing eats up all the error messages and mangles them.

Here's the thing: a typical file looks like this:

@lec{17}{\textit{(Provisional)} Analysis, Combinatorics}


which turns out to mean (in real LaTeX) just this:

\title{Lecture 17 \textit{(Provisional)} Analysis, Combinatorics}


So if I could just "define" "@localnotes" to mean "\include", I'd be about 90% of the way to being able to work with the notes without breaking anything from the other system.

Question: Is there a way to make something like "@localnotes" act as a latex macro? Perhaps equally important: is it certain that there is no way to do so? {If it can't be done, I'd like to stop looking for ways to do it!}.

I'm not very tex-savvy. At about the point where I see "makeatletter", I know that I'm about to not understand whatever follows. But if there's a solution that somehow uses this, I'll slog through it until I understand it.

Thanks in advance.

  • 1
    What the author's done here is defined @ to mean the same thing as \ -- certainly not something I'd ever do myself. It's very possible (and even common to do this sort of thing in package code) but I wouldn't recommend it in an 'author-level' document. I would take the time to turn all those @s into \s. Oct 21, 2015 at 16:32
  • As for the homebrew system, you can easily turn all these things into a key-value interface which will be much easier for that system to parse anyway. Oct 21, 2015 at 16:38
  • I think you're mistaken. What the author has done is write a program that consumes this file and spits out (in some hidden directory) an actual latex file in which the @-things are replaced with various \-things, and then runs latex on THOSE. I'm asking how I might do the thing that you thought that the author did. :)
    – John
    Oct 21, 2015 at 16:38
  • Ah, well then :) If these @ commands aren't going to be processed by TeX, you shouldn't be looking for a TeX way to define them. Oct 21, 2015 at 16:39
  • When I work with these same files, using Tex-shop, or TeXworks, or whatever, on my Windows machine, they actually WILL be processed by LaTeX, and I'm hoping to make it possible to do this by including a few definitions that make these things behave in the way I need, but without breaking the way that they're processed on the Linux system, because that processing does many other useful things (like putting them up on the course website, creating multiple versions of the PDF for homeworks --- one of which includes solutions, and is not distributed to students --- etc.).
    – John
    Oct 21, 2015 at 16:42

2 Answers 2


Just change @ to be the same as the backslash, after giving the appropriate definitions.

TeX doesn't bother what characters have category code 0, it just follows instructions. ;-) And it's immaterial what category code 0 character has been used for defining the macro.


\newcommand\lec[2]{Lecture #1 #2}



@lec{17}{\textit{(Provisional)} Analysis, Combinatorics}



In the document environment, after \catcode`@=0, you can use @cs or \cs with exactly the same result.

  • and hope that @ never appears in the text anywhere else. Oct 21, 2015 at 17:26
  • @barbarabeeton Ça va sans dire
    – egreg
    Oct 21, 2015 at 17:29

Here is a very simplified implementation of what you can do:

First: 123; Second: 456



\newcommand{\somemacroprocess}[2]{First: #1; Second: #2}




The idea is to make @ act just like \ by changing its category code via


That way you can define a macro called @somemacro that matches whatever you have in your input file. I've created a macro \somemacroprocess to be the replacement for @somemacro locally (inside a group), while defining \somemacroprocess in the usual way (outside the group).

  • This looks like exactly what I want (and similar to @egreg's answer, but perhaps safer, in case my document foolishly contains an email address...) I'll give it a try and report back. (BTW, not only may it do what I want, but I've now learned about "begingroup/endgroup", which I'd never seen before. Yay, Stackexchange!)
    – John
    Oct 21, 2015 at 17:36

You must log in to answer this question.

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