I have a bit of unclarity in regards to how we should count bytes in TeX. In general, coding in TeX is done through macros, introduced by the escape character. for examples \read16 is the macro which takes stdin.

I would like to know if we could count that as 1 byte for the following reason.

TeX doesn't process the characters that you input directly, it translates them into tokens, which then get processed. In fact, a lengthy macro name like \thisisverylong is actually one byte in TeX's memory.

I would certainly participate in this site more if we could consider every macro as the token it represents rather than the characters typed.


No. Your score in is the number of bytes needed to store your source code. TeX is no exception there. The only apparent exception are tokenized languages, like TI-Basic, but in the end, their score is exactly the number of bytes it takes to store the program on the computer.

Despite countless documents I made in LaTeX, I don't know how it works internally, but if TeX produces some intermediate file, you may also golf in that file format (much like assembly programmers). This is then not called TeX, but whatever the intermediate step is called. Alternatively, you are free to create your own golfing language based of off TeX if you really care that much about the absolute byte count.

However, my sincere advice is: don't care about your absolute byte count. The fun here is in trying to beat other using the same or similar languages. I personally only use a golfing language (MATL) since it's a very different way of golfing (generally minimizing the number of operations and playing with the stack). However, I find golfing in its parent language, MATLAB/Octave, just as much fun, because you can do things in ridiculously inefficient ways if it happens to use short function names.


You must log in to answer this question.

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