## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Sean Allred
@vermiculus
If you consider TikZ an application written in TeX, yes, that's exactly what happens.
Nicolas Mattia
@Nicowcow
Alright. That's good, I then won't have to think about it at all
But then I should differentiate about which environments are LaTeX environments, and which have "postprocessed" arguments
What did you mean by category code above? How does LaTeX deal with underscores in function names over subscripts?
Sean Allred
@vermiculus
Every character, when read in TeX's 'eyes', has at least two properties: actual character value (what you and I think of when we think 'character') and a character category code.
cf
The thing to remember with TeX is that everything is macro expansion on some level.
\begin{tikzpicture} (et al.) just make active certain definitions and alter TeX's reading state in such a way to make TeX understand what's being said.
Paired with all the macros it defines, this is the sense in which TikZ is a TeX program (i.e. program written in TeX)
It's still TeX doing all the work in the end.
Nicolas Mattia
@Nicowcow
Well, that's interesting
I'll dive into that post (and probably come back with more questions)
Sean Allred
@vermiculus
sounds good :)
Nicolas Mattia
@Nicowcow
Alright, I slept on it, and came to the following (let me know if that sounds correct to you)
I'll keep handling commands and environments as I have until now, that is, a command call is something like \commandname[all, the options and]{ all the }{ arguments you want}

where commandname only consists of letters
And then, use some kinds of addons that can be loaded, depending on what environment the parser is in
Or also depending on what packages are used
Sean Allred
@vermiculus
You could also adopt the TeX approach -- having a command to 'make-valid-command-character' a list of characters.
More importantly, you need to keep in mind that you can have more than one optional argument. anywhere. at all.
for example, \begin{env}[options]{arg}
(By the way, you can edit your recent messages by pressing the up arrow.)
Sean Allred
@vermiculus
If you're looking to add a new 'feature', having defined support for keyval arguments would be nifty :)
and tables, etc.
(though tables will be very hard to do well.)
Nicolas Mattia
@Nicowcow
You can have in between options for commands as well?
Looking at the official doc, it seemed to me it was only command name - options? - arguments
Are there any TeX or LaTeX specifications?
Sean Allred
@vermiculus
What official doc?
And yes, Knuth's The TeXbook for TeX and Lamport's LaTeX: A Document Preparation System for LaTeX.
Sean Allred
@vermiculus
But those texts are somewhat unhelpful for this
Particularly the TeXbook will inform you that TeX can only be parsed by TeX
I think it's more reasonable to just support LaTeX-style constructs (\command*[opt]{arg}[opt]{arg}(arg?)…)
Sean Allred
@vermiculus
That is, it will be easier to do that than to really undertake full TeX support
\def\hello#1.{says #1}
\hello world %error

\hello world. % says hello
It's ludicrous to try and support that with something like rulex
Nicolas Mattia
@Nicowcow
The tex SE question you linked is great, thanks
By the official documentation, I meant the User's Guide
Namely this
At section 3.4, it seemed to me that an official LaTeX command could only take the form of \thecommand[..]{...}, but since I have seen many other forms, it can't be right
Where did you get that form?> I think it's more reasonable to just support LaTeX-style constructs (\command*[opt]{arg}[opt]{arg}(arg?)…)
(And where does that argument in parentheses come from?)
(Or rather what kind of argument is it?)
Sean Allred
@vermiculus
You should read the documentation for xparse
By LaTeX-style constructs, I mean the common delimiters. ()<>[]{}. Of course then you have \verb, which throws a wrench in everything. Best to ignore it, I suppose.
Oh, and starred variants, of course.
You've stumbled onto one of the most difficult problems in theoretical computer science ;)