HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: //usr/share/enscript/hl/tex.st
/**
 * Name: tex
 * Description: TeX/LaTeX command, comment and math highlighting.
 * Author: Toni Giorgino <[email protected]>
 */

/* Syntactically highlights _every_ TeX command.  A more specialized
 * LaTeX mode might instead operate by keyword, eg. reproducing text
 * emphasis and boldface, perhaps cluttering the output too much.
 * Label and reference highlighting is a better candidate for a To Do
 * list.  Please report modifications.     TG
 */

state tex extends HighlightEntry
{
  /* escaped comment mark */
  /\\\\%/ {
    language_print ($0);
  }

  /* comment */
  /%/ {
    comment_face (true);
    language_print ($0);
    call (eat_one_line);
    comment_face (false);
  }

  /* one non-letter commands */
  /\\\\[^[:alpha:]]/ {
    keyword_face (true);
    language_print ($0);
    keyword_face (false);
  }

  /* multi letter commands */
  /\\\\[[:alpha:]]+/ {
    keyword_face (true);
    language_print ($0);
    keyword_face (false);
  }

  /* display math environment */
  /\$\$[^$]+\$\$/ {
    string_face (true);
    language_print ($0);
    string_face (false);
  }

  /* inline math environment */
  /\$[^$]+\$/ {
    variable_name_face (true);
    language_print ($0);
    variable_name_face (false);
   }
}


/*
Local variables:
mode: c
End:
*/