2

I recently downloaded Basic MiKTeX 2.9.4813..

I'm trying to find on the MiKTeX dir a file containing a list of all general keywords for LaTeX languages but can't find any...

Could you help me?

Jesse
  • 29,686
Nir B
  • 23
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. What do you mean by 'keyword'? Do you want a list of programs included in MikTeX or a list of commands (like \title{...}) available? (Try putting texdoc latexcheat into the command line.) – Sean Allred Dec 30 '13 at 12:05
  • Hi, I'm working on a project to develop a LaTeX compiler and want to identify if the user wrote a keyword so I can mark it in a specific color. For that I'm searching for a file containing all keywords.. – Nir B Dec 30 '13 at 12:18
  • 1
    You're not going to find one—use regular expressions: \\[@A-z]*\*? – Sean Allred Dec 30 '13 at 12:22
  • Can you please provide me more details about your answer? – Nir B Dec 30 '13 at 12:25
  • Yet another compiler? Which features should this compiler offer that we do not already have? – daleif Dec 30 '13 at 12:31
  • 1
    Here we go again: http://tex.stackexchange.com/questions/4201/is-there-a-bnf-grammar-of-the-tex-language/4205#4205 :) – Paulo Cereda Dec 30 '13 at 12:32
  • It's a study project... Is there a simple way to track common commands like Begin, End, etc'? – Nir B Dec 30 '13 at 12:47
  • 1
    @NirB no there is no way, the tokenization and keywords (as you call them) may be changed arbitrarily within the document: thereis no fixed grammar. – David Carlisle Dec 30 '13 at 12:56
  • @NirB: I go for Sean Allred's answer. Follow his hints and you will highlight all commands (that's the easiest way). For details about stackexchange go to the Help Center. – strpeter Dec 30 '13 at 14:25

1 Answers1

2

Within TeX systems, it is always possible to define new commands:

\def\somemacro\with#1\weird#2,#3\delimiters{#1, #2, #3}
\newcommand \somenewcommand[1] {some expansion using #1}
% ... the following with `xparse` and `expl3` as appropriate
\NewDocumentCommand \SomeCrazyCommand {m m o O{default} u{(} t! r][}{...}
% ... used as \SomeCrazyCommand{...}{...}[what?] this is arg 5(!]and 6[%end
\cs_new:Nn \you_can't_even_rely_on_the_hash:NnN {something~ with~ #1,~ #2~, and~ #3}

The only mostly constant thing is what counts as a command: it consists of a backslash (\) introducing either one symbol or a string of letters, thus the regular expression \\(.|[A-z@]*\*?]). (@ is often used as a letter in LaTeX internal macros. Also, many LaTeX commands have starred variants.)

Trying to compile such a list would be difficult, but you can take a look at the AUCTeX project for Emacs—within the style files exist convenient lists of commands for particular packages.

Sean Allred
  • 27,421
  • 1
    In pure TeX you can only define a new command with \def. \newcommand is a LaTeX command. ;) – someonr Dec 30 '13 at 12:36
  • @someonr Or \ExplSyntaxOn \use:c { some_weird_arg_based_command_#1 },\cs_new:Nn \@@_internal_package_macro:Nnx \ExplSyntaxOff… the list goes on. TeX's Turing completeness throws a wrench in just about every hopeful parser. – Sean Allred Dec 30 '13 at 12:39
  • 2
    For a stress test look up xii.tex on CTAN, http://www.ctan.org/tex-archive/macros/plain/contrib/xii – daleif Dec 30 '13 at 12:40
  • @daleif Didn't David Carlisle write this? http://tex.stackexchange.com/questions/104248 – Sean Allred Dec 30 '13 at 12:41
  • @SeanAllred I think so yes, just to show that making a parser is not a trivial matter. Though the example is TeX and the OP refers to LaTeX. – daleif Dec 30 '13 at 12:54
  • 4
    who, me :-) ??? – David Carlisle Dec 30 '13 at 13:27