project
stringlengths
1
38
source
stringclasses
7 values
doc
stringlengths
0
48M
rules_phrase_idx
ctan
**1. Grammar symbols: Used cross reference.** Reference of each grammar's symbol used within each rule's productions. The index uses the tripple: rule name, its subrule no, and the symbol's position within the symbol string. **2. NS_rules_phrase_th::TH_rules_phrase_th::** Rphrase 1.3 **3. NULL thread:.** Rphrase 2.3 **4. Rphrase:.** Rrules_phrase 1.1 **5. rules-phrase:.** Rphrase 1.2 **6.** |?|::. Rphrase 2.2 Rphrase 3.1 **7.** ||!:. Rphrase 1.1 Rphrase 2.1 **8. Grammar Rules's First Sets.** **9.** _Rrules_phrase_ **# in set: 2.** 1?|| || **10.** _Rphrase_ **# in set: 2.** 1?|| || **11.** **LR State Network.** List of productions with their derived LR state lists. Their subrule number and symbol string indicates the specific production being derived. The "p" symbol indicates the production's list of derived states from its closured state. Multiple lists within a production indicate 1 of 2 things: 1) derived string that could not be merged due to a lr(1) conflict 2) partially derived string merged into another derived lr states A partially derived string is indicated by the "merged into" symbol \(\nearrow\)used as a superscript along with the merged into state number. **12.** **Rrules_phrase.** 1 Rphrase \(\triangleright\) 1 6 **13.** **Rphrase.** 1 || rules-phrase NS_rules_phrase_th::TH_rules_phrase_th \(\triangleright\) 1 3 5 2 || || || NULL \(\triangleright\) 1 3 4 3 |?| \(\triangleright\) 1 2 **14.** **List of reducing states.** The following legend indicates the type of reducing state. Points 2-4 are states that must meet the lr(1) condition: 1) r -- only 1 production reducing 2) r\({}^{2}\) -- 2 or more reducing productions 3) s/r -- shift and 1 reducing production 4) s/\(r^{2}\) -- shift and multiple reducing productions \(\subset\) 2\({}^{r}\)\(4^{r}\)\(5^{r}\)\(6^{r}\) **15.** **Lr1 State's Follow sets and reducing lookahead sets.** Notes on Follow set expressions: 1) The "follow set" for rule uses its literal name and tags its grammar rule rank number as a superscript. Due to space limitations, part of the follow set information uses the rule's literal name while the follow set expressions refers to the rule's rank number. This \(<\) rule name, rule rank number \(>\) tuple allows you the reader to decifer the expressions. Transitions are represented by S\({}_{x}\)R\({}_{z}\) whereby S is the LR1 state identified by its "x" subscript where other transient calculations occur within the LR1 state network. R indicates the follow set rule with the subscript "z" as its grammar rank number that contributes to the follow set. The \(\nearrow\)\({}^{x}\) symbol indicates that a merge into state "x" has taken place. That is, the reduced subrule that depends on this follow set finds its follow set in 2 places: its birthing state that generated the sequence up to the merged into state, and the birthing state that generated the "merged into" state. So the rule's "follow set" calculation must also continue its calculation within the birth state generating the "x merged into" state. \begin{tabular}{l l l l} State: & 1 & Follow Set contributors, merges, and transitions \\ \(\leftarrow\) & Follow set Rule & \(\rightarrow\leftarrow\) & follow set symbols contributors & \(\rightarrow\) \\ Rules\_phrase1 & & & & \\ Local follow set yield: & & & & \\ \(\leftarrow\) & Follow set Rule & \(\rightarrow\leftarrow\) & follow set symbols contributors & \(\rightarrow\) \\ Rphrase2 & & R\({}_{1\mbox{-}1\mbox{-}1}\) S\({}_{1}R_{1}\) & & & \\ Local follow set yield: & & & & \\ \end{tabular} Common Follow sets. * 17 LA set: 1. eolr. **18.** **Index.** R\({}_{1}\) **---** **Rrules_phrase: 12.** R\({}_{2}\) **---** **Rphrase: 13.** _Rphrase_: 10.** _Rrules_phrase_: 9.**
hep
ctan
# The hep-reference package+ Footnote †: This document corresponds to hep-reference v1.2. Adjustments of standard references, footnote, and citations Jan Hajer jan.hajer@tecnico.ullsboa.pt 2023/07/01 ###### Abstract The hep-reference package applies some light convenience modifications to the reference, citation and footnote macros after loading standard classes improving on the default LaTeX behaviour. ## 1 Introduction The hyperref package is loaded and the links are hidden. \cref References are extended with the cleveref package [1], which allows to e.g. just type \cref(\_key) in order to write 'figure 1'. Furthermore, the cleveref package allows to reference multiple objects within one \creff(\_key_,_key_2). \cite Citations are adjusted to not start on a new line in order to avoid the repeated use of \cite(\_key_). \ref References are also adjusted to not start on a new line. \eqref Footnotes are adjusted to swallow white space before the footnote mark and at the beginning of \subref the footnote text. Additionally the reference back to the text where they are called from. \footnote ## References * [1] T. Cubitt. 'The cleveref package: Intelligent cross-referencing' (2006). CTAN: cleveref. url: dr-qubit.org/cleveref.
hep
ctan
# The hep-text package+ Footnote †: This document corresponds to hep-text v1.2. List and text extensions Jan Hajer 2023/07/01 ###### Abstract The hep-text package extends LaTeX lists using the enumitem package and provides some text macros. The package can be loaded by \usepackage{hep-text}. lang The lang option sets the used language and takes the values allowed by the babel package [1], that is loaded for its hyphenation support. \enquote Quotation commands are provided by the csquotes package [2]. It provides the convenient macros \enquote{_text_} and \MakeOuterQuote{_} allowing to leave the choice of quotation marks to LaTeX and use * instead of the pair ** and **, respectively. \eg The foreign package [3] defines macros such as \eg, \ef, and \vs which are typeset as e.g., i.e., \vs cf., and vs. with the appropriate spacing. Issuing \renewcommand{foreignabbrfont{}tishape} these abbreviations are typeset in italic. \no The \no{_number_} macro is typeset as \^*123. \software The \sortware{_version_}\{_name_} macro is typeset as HEP-Paper v1.2. \online The \online{_url_}\{_text_} macro combines the features of the \href{_url_}\{_text_}\{_text_}\{_text_}\{_text_}\{_text_}\{_text_}\{_text_}\}[4] and the \url{_text_}\{_text_}\{_text_}\{_text_}\}[5] macros, resulting in e.g. \enquote{_text_}. \inlinelist The inlinelist and enumdescript environments are defined using the enumitem package [6]. The three main points are 1) one, \two; and \begin{_initialist_} \item one \item two \item three \end{table} Table 1: The \nolot{_number_} macro is redefined using the enumitem package [7]. ## References * [1] J. Braams, J. Bezos, and at al. 'Babel Localization and internationalization: Multilingual support for Plain TeX or LaTeX' (1989). CTAN: babel. GitHub: latex3/babel. * [2] P. Lehman and J. Wright. 'The csquotes Package: Context sensitive quotation facilities' (2003). CTAN: csquotes. * [3] P. G. Ratcliffe. 'The foreign package for LaTeX 2\({}_{\varepsilon}\): Systematic treatment of "foreign" words in documents' (2012). CTAN: foreign. * [4]_LaTeX3 Project_. 'Hypertext marks in LaTeX: a manual for hyperref: Extensive support for hypertext in LaTeX' (1995). CTAN: hyperref. GitHub: latex3/hyperref. * [5] D. Arseneau. 'The url package: Verbatim with URL-sensitive line breaks' (1996). CTAN: url. * [6] J. Bezos. 'Customizing lists with the enumitem package: Control layout of itemize, enumerate, description' (2003). CTAN: enumitem. url: texnia.com/enumitem.html. GitHub: jbezos/enumitem. * [7] H. Oberdiek. 'The soulutt8 package: Permit use of UTF-8 characters in soul' (2007). CTAN: soulutt8.
eval_phrases
ctan
Copyright. Copyright (c) Dave Bone 1998 - 2015eval_phrases Grammar. Make sure all the grammar phases are properly parsed. This is due to my not programming a grammar sequencer to explicitly define the syntax of a grammar. I wanted to parse each phrase separately by keyword triggering a descent procedure. Question: What source GPS do u align the error against? i just place it to the beginning of the grammar file if there is no previous phase seen. A previous phase becomes the reference point to the source file. If i was energetic, i should get the last token of that phase to be more accurate but today i'm lazy. The message is adequate to correct the problem. ## 3 Fsm Ceval_phrases class. ### Ceval_phrases op directive. (Ceval_phrases op directive 4) = _gps_ = 0_; ### Ceval_phrases user-declaration directive 5) = (Ceval_phrases user-declaration directive 5) = **public**: _CAbs_lr1_sym * gps_; **void**_post_error_(_CAbs_lr1_sym * Err_); **void**_post_gps_(_CAbs_lr1_sym * Sym_); ### Ceval_phrases user-implementation directive. (Ceval_phrases user-implementation directive 6) = **void**_Ceval_phrases :: post_error_(_CAbs_lr1_sym * Err_) { **using namespace NS_yacco2_T_enum**; _Err_-_set_rc_(\(*\)_gps_, __FILE_, __LINE_); **if**: (_gps_-_enumerated_id_ = _T_Enum_:: _T_LR1_eog_) { _Err_-_set_line_no_and_pos_in_line_(1,1); _parser_-_add_token_to_error_queue_(\(*\)_Err_); _parser_-_set_abort_parse_(_true_); } ### post_gps. (More code 7) = **void**_Ceval_phrases :: post_gps_(_CAbs_lr1_sym * Sym_) { _gps_ = Sym_; **13**. _Rparallel_phrase_ **rule.** Rparallel_phrase parallel-parser-phrase **14**. _Rparallel_phrase_'s subrule 1.** parallel-parser-phrase **1**. (Rparallel_phrase subrule 1 op directive 14) \(\equiv\) _Ceval_phrases \(*\) fsm =_ (_Ceval_phrases \(*\)_) _rule_info_parser_~fsm_tbl_; _fsm_post_gps_(_sf~p1_); **15**. _RT_enum_phrase_ **rule.** **16**. _RT_enum_phrase_'s subrule 1.** **1**. (RT_enum_phrase subrule 1 op directive 16) \(\equiv\) _Ceval_phrases \(*\) fsm =_ (_Ceval_phrases \(*\)_) _rule_info_parser_~fsm_tbl_; _fsm_post_gps_(_sf~p1_); **17**. _RT_enum_phrase_'s subrule 2.** **1**. (RT_enum_phrase subrule 2 op directive 17) \(\equiv\) _Ceval_phrases \(*\) fsm =_ (_Ceval_phrases \(*\)_) _rule_info_~_parser_~~fsm_tbl_; _fsm_post_gps_(_sf~p1_); _fsm_post_error_(**new_ERR_no_T_enum_phrase_); **18**. _Rerr_sym_phrase_ **rule.** Rerr_sym_phrase error-symbols-phrase **19**. _RT_enum_phrase subrule 2.** **19**.: _Rerr_sym_phrase_**'s subrule 1.** (Rerr_sym_phrase subrule 1 op directive 19) = _Ceval_phrases \(*\)fsm =_ ( _Ceval_phrases \(*\)_) _rule_info_parser_~fsm_tbl_; _fsm_post_gps_(_sf~p1_); **20**.: _Rerr_sym_phrase_**'s subrule 2.** (Rerr_sym_phrase subrule 2 op directive 20) = _Ceval_phrases \(*\)fsm =_ ( _Ceval_phrases \(*\)_) _rule_info_~_parser_~fsm_tbl_; _fsm_post_gps_(_sf~p1_); _fsm_post_error_(**new _ERR_no_errors_phrase_**); **21**.: _Rrc_phrase_**'s subrule 1.** (Rrc_phrase subrule 1 op directive 22) = _Ceval_phrases \(*\)fsm =_ ( _Ceval_phrases \(*\)_) _rule_info_~_parser_~fsm_tbl_; _fsm_post_gps_(_sf~p1_); **23**.: _Rrc_phrase_**'s subrule 2.** (Rrc_phrase subrule 2 op directive 23) = _Ceval_phrases \(*\)fsm =_ ( _Ceval_phrases \(*\)_) _rule_info_~_parser_~fsm_tbl_; _fsm_post_gps_(_sf~p1_); _fsm_post_error_(**new _ERR_no_rc_phrase_**); **24**.: _Rlr1_k_phrase_**rule.** Rlr1_k_phrase (Rlr1_k_phrase); (Rrc_phrase subrule 2 op directive 23) = _Ceval_phrases \(*\)fsm =_ ( _Ceval_phrases \(*\)_) _rule_info_~_parser_~fsm_tbl_; _fsm_post_gps_(_sf~p1_); _fsm_post_error_(**new _ERR_no_rc_phrase_**); **25**.: _Rlr1_k_phrase_**rule.** **31.**_Rrules_phrase's subrule 1._ (Rrules_phrase subrule 1 op directive 31) \(\equiv\) _Ceval_phrases \(*\)fsm =_ (_Ceval_phrases \(*\)_) _rule_info__parser__-fsm_tbl__; _fsm_-post_gps_(_sf_~p1__); **32.**_Rrules_phrase's subrule 2._ (Rrules_phrase subrule 2 op directive 32) \(\equiv\) _Ceval_phrases \(*\)fsm =_ (_Ceval_phrases \(*\)_) _rule_info__parser__-fsm_tbl__; _fsm_-post_gps_(_sf_~p1__); _fsm_-post_error_(**new**_ERR_no_rules_phrase_); ## 33 First Set Language for \(O_{2}^{linker}\). /* File: eval_phrases.fsc Date and Time: Fri Jan 2 15:33:35 2015 */ transitive n grammar-name "eval_phrases" name-space "NS_eval_phrases" thread-name "Ceval_phrases" monolithic y file-name "eval_phrases.fsc" no-of-T 569 list-of-native-first-set-terminals 3 LR1_questionable_shift_operator LR1_eog T_fsm_phrase end-list-of-native-first-set-terminals list-of-transitive-threads 0 end-list-of-transitive-threads list-of-used-threads 0 end-list-of-used-threads fsm-comments "Evaluate parse phrase sequencer: \n as i use a top / down approach to dispatching the various phrases." **35. Index.** \(\epsilon\) : 13. |?!: 10, 15, 18, 21, 24, 27, 30. __FILE__: 6. __LINE__: 6. _add_token_to_error_queue_: 6. _CAbs_lr1_sym_: 5, 6, 7. _Ceval_phrases_: 6, 7, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32. _enumerated_id_: 6. eog: 8. _Err_: 5, 6. _Err_empty_file_: 9. _ERR_no_errors_phrase_: 20. _ERR_no_fsm_phrase_: 12. _ERR_no_lrk_phrase_: 26. _ERR_no_rc_phrase_: 23. _ERR_no_rules_phrase_: 32. _ERR_no_T_enum_phrase_: 17. _ERR_no_terminals_phrase_: 29. error-symbols-phrase: 18. _eval_phrases_: 2. _fsm_: 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32. fsm_phrase_: 10. _fsm_tbl_: 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32. _gps_: 4, 5, 6, 7. 1r1-k-phrase: 24. **NS_yacco2_T_enum**: 6. parallel-parser-phrase: 13. _parser_: 6, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32._ _post_error_: 5, 6, 9, 12, 17, 20, 23, 26, 29, 32. _post_gps_: 5, 7, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32. _p1_: 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32._ _26, 28, 29, 31, 32._ rc-phrase: 21. Rerr_sym_phrase_: 8. _Rerr_sym_phrase_: 18, 19, 20. _Reval_phrases_: 8, 9. Rfsm_phrase_: 8. _Rfsm_phrase_: 8. _Rfsm_phrase_: 10, 11, 12. Rlrl_k_phrase_: 8. _Rlrl_k_phrase_: 24, 25, 26. Rparallel_phrase_: 8. _Rparallel_phrase_: 13, 14. Rrc_phrase_: 8. _Rrc_phrase_: 21, 22, 23. Rrules_phrase_: 8. _Rrules_phrase_: 30, 31, 32._ _RT_enum_phrase_: 8. _RT_enum_phrase_: 15, 16, 17. Rterms_phrase_: 8. _Rterms_phrase_: 27, 28, 29. _rule_info_: 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32._ _Sym_: 5, 7. T-enum-phrase: 15. _T_Enum_: 6. _T_LR1_eog_: 6. terminals-phrase: 27. _true_: 6. \(\langle\)Ceval_phrases op directive 4\(\rangle\)\(\langle\)Ceval_phrases user-declaration directive 5\(\rangle\)\(\langle\)Ceval_phrases user-implementation directive 6\(\rangle\)\(\langle\)More code 7\(\rangle\)\(\langle\)RT_enum_phrase subrule 1 op directive 16\(\rangle\langle\)RT_enum_phrase subrule 2 op directive 17\(\rangle\langle\)Rerr_sym_phrase subrule 1 op directive 19\(\rangle\langle\)Rerr_sym_phrase subrule 2 op directive 20\(\rangle\langle\)Reval_phrases subrule 2 op directive 9\(\rangle\langle\)Rfsm_phrase subrule 1 op directive 11\(\rangle\langle\)Rfsm_phrase subrule 2 op directive 12\(\rangle\langle\)Rlrl_k_phrase subrule 1 op directive 25\(\rangle\langle\)Rlr1_k_phrase subrule 2 op directive 26\(\rangle\langle\)Rparallel_phrase subrule 1 op directive 14\(\rangle\langle\)Rrc_phrase subrule 1 op directive 22\(\rangle\langle\)Rrc_phrase subrule 2 op directive 23\(\rangle\langle\)Rrules_phrase subrule 1 op directive 31\(\rangle\langle\)Rrules_phrase subrule 2 op directive 32\(\rangle\langle\)Rterms_phrase subrule 1 op directive 28\(\rangle\langle\)Rterms_phrase subrule 2 op directive 29\(\rangle\)
clsguide
ctan
# IATEX for package and class authors -- current version (c) Copyright 2023, LaTeX Project Team. All rights reserved. This file may distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. See the source clsguide.tex for full details. 2023-01-12 ###### Contents * 1 Introduction * 2 Writing classes and packages * 2.1 Is it a class or a package? * 2.2 Using 'docstrip' and 'doc' * 2.3 Policy on standard classes * 2.4 Command names * 2.5 Programming support * 2.6 Box commands and color * 2.7 General style * 3 The structure of a class or package * 3.1 Identification * 3.2 Using classes and packages * 3.3 Declaring options * 3.4 A minimal class file * 3.5 Example: a local letter class * 3.6 Example: a newsletter class * 4 Commands for class and package writers * 4.1 Identification * 4.2 Loading files * 4.3 Delaying code * 4.4 Creating and using keyval options * 4.5 Passing options around * 4.6 Safe file commands * 4.7 Reporting errors, etc * 5Miscellaneous commands, etc. * 5.1 Layout parameters * 5.2 Case changing * 5.3 Better user-defined math display environments * 5.4 Normalising spacing * 5.5 Querying localisation * 6 Commands superseded for new material * 6.1 Defining commands * 6.2 Option declaration * 6.3 Commands within option code * 6.4 Option processing ## 1 Introduction \(\mathsf{LaTeX}\,2_{\varepsilon}\) was released in 1994 and added a number of then-new concepts to \(\mathsf{LaTeX}\). For package and class authors, these are described in clsguide-historic, which has largely remained unchanged. Since then, the \(\mathsf{LaTeX}\) team have worked on a number of ideas, firstly a programming language for \(\mathsf{LaTeX}\) (L3 programming layer) and then a range of tools for authors which build on that language. Here, we describe the current, stable set of tools provided by the \(\mathsf{LaTeX}\) kernel for package and class developers. We assume familiarity with general \(\mathsf{LaTeX}\) usage as a document author, and that the material here is read in conjunction with usrguide, which provides information for general \(\mathsf{LaTeX}\) users on up-to-date approaches to creating commands, etc. ## 2 Writing classes and packages This section covers some general points concerned with writing \(\mathsf{LaTeX}\) classes and packages. ### Is it a class or a package? The first thing to do when you want to put some new \(\mathsf{LaTeX}\) commands in a file is to decide whether it should be a _document class_ or a _package_. The rule of thumb is: If the commands could be used with any document class, then make them a package; and if not, then make them a class. There are two major types of class: those like article, report or letter, which are free-standing; and those which are extensions or variations of other classes--for example, the proc document class, which is built on the article document class. Thus, a company might have a local ownlet class for printing letters with their own headed note-paper. Such a class would build on top of the existing letter class but it cannot be used with any other document class, so we have ownlet.cls rather than ownlet.sty. The graphics package, in contrast, provides commands for including images into a LaTeX document. Since these commands can be used with any document class, we have graphics.sty rather than graphics.cls. ### Using 'docstrip' and 'doc' If you are going to write a large class or package for LaTeX then you should consider using the doc software which comes with LaTeX. LaTeX classes and packages written using this can be processed in two ways: they can be run through LaTeX, to produce documentation; and they can be processed with docstrip, to produce the.cls or.sty file. The doc software can automatically generate indexes of definitions, indexes of command use, and change-log lists. It is very useful for maintaining and documenting large TeX sources. The documented sources of the LaTeX kernel itself, and of the standard classes, etc., are doc documents; they are in the.dtx files in the distribution. You can, in fact, typeset the source code of the kernel as one long document, complete with index, by running LaTeX on source2e.tex. Typesetting these documents uses the class file ltxdoc.cls. For more information on doc and docstrip, consult the files docstrip.dtx, doc.dtx, and _The LaTeX Companion_. For examples of its use, look at the.dtx files. ### Policy on standard classes Many of the problem reports we receive concerning the standard classes are not concerned with bugs but are suggesting, more or less politely, that the design decisions embodied in them are 'not optimal' and asking us to modify them. There are several reasons why we should not make such changes to these files. * However misguided, the current behaviour is clearly what was intended when these classes were designed. * It is not good practice to change such aspects of'standard classes' because many people will be relying on them. We have therefore decided not to even consider making such modifications, nor to spend time justifying that decision. This does not mean that we do not agree that there are many deficiencies in the design of these classes, but we have many tasks with higher priority than continually explaining why the standard classes for LaTeX cannot be changed. We would, of course, welcome the production of better classes, or of packages that can be used to enhance these classes. So your first thought when you consider such a deficiency will, we hope, be "what can I do to improve this?" ### Command names Prior to the introduction of the L3 programming layer described in the next section, LaTeX had three types of command. There are the author commands, such as \section, \emph and \times: most of these have short names, all in lower case. There are also the class and package writer commands: most of these have long mixed-case names such as the following. \InputIfFileExists \RequirePackage \PassOptionsToClass Finally, there are the internal commands used in the LaTeX implementation, such as \@tempcnta, \@ifnextchar and \@eha: most of these commands contain \@ in their name, which means they cannot be used in documents, only in class and package files. Unfortunately, for historical reasons the distinction between these commands is often blurred. For example, \bbox is an internal command which should only be used in the LaTeX kernel, whereas \m@ne is the constant \(-1\) and could have been \MinusOne. However, this rule of thumb is still useful: if a command has \@ in its name then it is not part of the supported LaTeX language--and its behaviour may change in future releases! If a command is mixed-case, or is described in _LaTeX: A Document Preparation System_, then you can rely on future releases of LaTeX supporting the command. ### Programming support As noted in the introduction, the LaTeX kernel today loads dedicated support from programming, here referred to as the L3 programming layer but also often called \expl3. Details of the general approach taken by the L3 programming layer are given in the document expl3, while a reference for all current code interfaces is available as interface3. This layer contains two types of command: a documented set of commands making up the API and a large number of private internal commands. The latter all start with two underscores and should not be used outside of the code module which defines them. This more structured approach means that using the L3 programming layer does not suffer from the somewhat fluid situation mentioned above with '\@ commands'. We do not cover the detail of using the L3 programming layer here. A good introduction to the approach is provided at [https://www.alanshawn.com/latex3-tutorial/](https://www.alanshawn.com/latex3-tutorial/). ### Box commands and color Even if you do not intend to use color in your own documents, by taking note of the points in this section you can ensure that your class or package is compatiblewith the color package. This may benefit people using your class or package and wish to use color. The simplest way to ensure 'color safety' is to always use LaTeX box commands rather than TeX primitives, that is use \sbox rather than \ssetbox, \mbox rather than \hbox and \parbox or the minipage environment rather than \vbox. The LaTeX box commands have new options which mean that they are now as powerful as the TeX primitives. As an example of what can go wrong, consider that in {\ttfamily <text>} the font is restored just _before_ the }, whereas in the similar looking construction {\color{green} <text>} the color is restored just _after_ the final }. Normally this distinction does not matter at all; but consider a primitive TeX box assignment such as: \ssetbox0=\hbox{\color{green} <text>} Now the color-restore occurs after the } and so is _not_ stored in the box. Exactly what bad effects this can have depends on how color is implemented: it can range from getting the wrong colors in the rest of the document, to causing errors in the dvi-driver used to print the document. Also of interest is the command \normalcolor. This is normally just \relax (i.e., does nothing) but you can use it rather like \normalfont to set regions of the page such as captions or section headings to the'main document color'. ### General style LaTeX provides many commands designed to help you produce well-structured class and package files that are both robust and portable. This section outlines some ways to make intelligent use of these. #### Loading other files LaTeX provides these commands: \LoadClass \LoadClassWithOptions \RequirePackage \RequirePackageWithOptions for using classes or packages inside other classes or packages. We recommend strongly that you use them, rather than the primitive \input command, for a number of reasons. Files loaded with \input <filename> will not be listed in the \listfiles list. If a package is always loaded with \RequirePackage... or \usepackage then, even if its loading is requested several times, it will be loaded only once. By contrast, if it is loaded with \input then it can be loaded more than once; such an extra loading may waste time and memory and it may produce strange results. If a package provides option-processing then, again, strange results are possible if the package is \input rather than loaded by means of \usepackage or \RequirePackage.... If the package foo.sty loads the package baz.sty by use of \input baz.sty then the user will get a warning: LaTeX Warning: You have requested package 'foo', but the package provides 'baz'. Thus, for several reasons, using \input to load packages is not a good idea. For example, article.sty contains just the following lines: \NeedsTeXFormat{LaTeX2e} \@obsoletefile{article.cls}{article.sty} \LoadClass{article} You may wish to do the same or, if you think that it is safe to do so, you may decide to just remove myclass.sty. #### 2.7.2 Make it robust We consider it good practice, when writing packages and classes, to use LaTeX commands as much as possible. Thus, instead of using \def... we recommend using one of \newcommand, \renewcommand or \providecommand for programming and for defining document interfaces \NewDocumentCommand, etc. (see usrguide for details of these commands). When you define an environment, use \NewDocumentEnvironment, etc., (or \newenvironment, etc., for simple cases) instead of using \def\foo{...} and \def\endfoo{...}. If you need to set or change the value of a \(\mathit{dimen}\) or \(\mathit{skip}\) register, use \setlength. To manipulate boxes, use LaTeX commands such as \sbox, \mbox and \parbox rather than \setbox, \hbox and \vbox. Use \PackageError, \PackageWarning or \PackageInfo (or the equivalent class commands) rather than \@latexerr, \@warning or \wlog. The advantage of this kind of practice is that your code is more readable and accessible to other experienced LaTeX programmers. #### 2.7.3 Make it portable It is also sensible to make your files are as portable as possible. To ensure this, files must not have the same name as a file in the standard LaTeX distribution, however similar its contents may be to one of these files. It is also still lower risk to stick to file names which use only the ASCII range: whilst LaTeX works natively with UTF-8, the same cannot be said with certainty for all tools. For the same reason, avoid spaces in file names. It is also useful if local classes or packages have a common prefix, for example the University of Nowhere classes might begin with unw. This helps to avoid every University having its own thesis class, all called thesis.cls. If you rely on some features of the LaTeX kernel, or on a package, please specify the release-date you need. For example, the package error commands were introduced in the June 2022 release so, if you use them then you should put: \NeedsTeXFormat{LaTeX2e}[2022-06-01] #### 2.7.4 Useful hooks It is sometimes necessary for a package to arrange for code to be executed at the start or end of the preamble, at the end of the document or at the start of every use of an environment. This can be carried out by using hooks. As a document author, you will likely be familiar with \AtBeginDocument, a wrapper around the more powerful command \AddToHook. The LaTeX kernel provides a large number of dedicated hooks (applying in a pre-defined location) and generic hooks (applying to arbitrary commands): the interface for using these is described in 1thooks. There are also hooks to apply to files, described in 1tfilehooks. ## 3 The structure of a class or package The outline of a class or package file is: **Identification**: The file says that it is a LaTeX 2\(\varepsilon\) package or class, and gives a short description of itself. **Preliminary declarations**: Here the file declares some commands and can also load other files. Usually these commands will be just those needed for the code used in the declared options. **Options**: The file declares and processes its options. **More declarations**: This is where the file does most of its work: declaring new variables, commands and fonts; and loading other files. ### Identification The first thing a class or package file does is identify itself. Package files do this as follows: \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{<package>}[<date> <other information>]For example: \WeedsTeXFormat{LaTeX2e} \ProvidesPackage{latexsym}[1998-08-17 Standard LaTeX package] Class files do this as follows: \WeedsTeXFormat{LaTeX2e} \ProvidesClass{<class-name>}[<date> <other information>] For example: \WeedsTeXFormat{LaTeX2e} \ProvidesClass{article}[2022-06-01 Standard LaTeX class] The \(date\) should be given in the form 'yyyy-mm-dd' and must be present if the optional argument is used (this is also true for the \WeedsTeXFormat command). Any derivation from this syntax will result in low-level TeX errors--the commands expect a valid syntax to speed up the daily usage of the package or class and make no provision for the case that the developer made a mistake! This date is checked whenever a user specifies a date in their \documentclass or \usepackage command. For example, if you wrote: \documentclass{article}[2022-06-01] then users at a different location would get a warning that their copy of article was out of date. The description of a class is displayed when the class is used. The description of a package is put into the log file. These descriptions are also displayed by the \listfiles command. The phrase Standard LaTeX **must not** be used in the identification banner of any file other than those in the standard LaTeX distribution. ### Using classes and packages A LaTeX package or class can load a package as follows: \RequirePackage[<options>]{package>}[<date>] For example: \RequirePackage{ifthen}[2022-06-01] This command has the same syntax as the author command \usepackage. It allows packages or classes to use features provided by other packages. For example, by loading the ifthen package, a package writer can use the 'if...then...else...' commands provided by that package. A LaTeX class can load one other class as follows:\LoadClass[<options>]{<class-name>}[<date>] For example: \LoadClass[twocolumn]{article} This command has the same syntax as the author command \documentclass. It allows classes to be based on the syntax and appearance of another class. For example, by loading the article class, a class writer only has to change the bits of article they don't like, rather than writing a new class from scratch. The following commands can be used in the common case that you want to simply load a class or package file with exactly those options that are being used by the current class. \LoadClassWithOptions{<class-name>}[<date>] \RequirePackageWithOptions{<package>}[<date>] For example: \LoadClassWithOptions{article} \RequirePackageWithOptions{graphics}[1995/12/01] ### Declaring options Packages and classes can declare options and these can be specified by authors; for example, the twocolumn option is declared by the article class. Note that the name of an option should contain only those characters allowed in a 'LaTeX name'; in particular it must not contain any control sequences. LaTeX supports two methods for creating options: a key-value system and a'simple text' approach. The key-value system is recommended for new classes and packages, and is more flexible in handling of option classes than the simple text approach. Both option methods use the same basic structure within the LaTeX source: declaration of options first then processing options in a second step. Both also allow options to be passed on to other packages or an underlying class. As the 'classical' simple text approach is conceptually more straightforward to illustrate, it is used here to show the general structure: see Section 4.4 for full details of the key-value approach. An option is declared as follows: \DeclareOption{<option>}{<code>} For example, the dvips option (slightly simplified) to the graphics package is implemented as: \DeclareOption{dvips}{\input{dvips.def}} This means that when an author writes \usepackage[dvips]{graphics}, the file dvips.def is loaded. As another example, the a4paper option is declared in the article class to set the \paperheight and \paperwidth lengths: \DeclareOption{a4paper}{ \setlength{paperheight}{297mm}% \setlength{paperwidth}{210mm}% } Sometimes a user will request an option which the class or package has not explicitly declared. By default this will produce a warning (for classes) or error (for packages); this behaviour can be altered as follows: \DeclareOption*{<code>} For example, to make the package fred produce a warning rather than an error for unknown options, you could specify: \DeclareOption*{% \PackageWarning{fred}{Unknown option '\CurrentOption'}% } Then, if an author writes \usepackage[foo]{fred}, they will get a warning Package fred Warning: Unknown option 'foo'. As another example, the fontenc package tries to load a file <ENC>enc.def whenever the \(\mathit{ENC}\) option is used. This can be done by writing: \DeclareOption*{% \input{\CurrentOption enc.def}% } It is possible to pass options on to another package or class, using the command \PassOptionsToPackage or \PassOptionsToClass (note that this is a specialised operation that works only for option names): see Section 4.5. For example, to pass every unknown option on to the article class, you can use: \DeclareOption*{% \PassOptionsToClass{\CurrentOption}{article}% } If you do this then you should make sure you load the class at some later point, otherwise the options will never be processed! So far, we have explained only how to declare options, not how to execute them. To process the options with which the file was called, you should use: \ProcessOptions\relax \DeclareOption*{VassOptionsToClass{\CurrentOption}{letter}} \ProcessOptions\relax \LoadClass[a4paper]{letter} In order to use the company letter head, it redefines the firstpage page style: this is the page style that is used on the first page of letters. \renewcommand{\ps@firstpage}{% \renewcommand{\@oddhead}{<letterhead goes here>}% \renewcommand{\@oddfoot}{<letterfoot goes here>}% } And that's it! ### Example: a newsletter class A simple newsletter can be typeset with LaTeX, using a variant of the article class. The class begins by announcing itself as smplnews.cls. \WeedsTeXFormat{LaTeX2e} \ProvidesClass{smplnews}[2022-06-01 The Simple News newsletter class] \newcommand{\headlinecolor}{\normalcolor} It passes most specified options on to the article class: apart from the onecolumn option, which is switched off, and the green option, which sets the headline in green. \DeclareOption{onecolumn}{\OptionNotUsed} \DeclareOption{green}{\renewcommand{\headlinecolor}{\color{green}}} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax It then loads the class article with the option twocolumn. \LoadClass[twocolumn]{article} Since the newsletter is to be printed in colour, it now loads the color package. The class does not specify a device driver option since this should be specified by the user of the smplnews class. \RequirePackage{color} The class then redefines \maketitle to produce the title in 72 pt Helvetica bold oblique, in the appropriate colour. \renewcommand{\maketitle}{% \twocolumn[% \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} It redefines \section and switches off section numbering. \renewcommand{\section}{\fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \section{\fontsize{} \fontsize{} \fontsize{} It also sets the three essential things. \renewcommand{\normalsize}{\fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} \fontsize{} In practice, a class would need more than this: it would provide commands for issue numbers, authors of articles, page styles and so on; but this skeleton gives a start. The ltnews class file is not much more complex than this one. ## 4 Commands for class and package writers This section describes briefly each of the commands for class and package writers. To find out about other aspects of the system, you should also read LaTeX: _A Document Preparation System_, _The LaTeX Companion_ and LaTeX 2_\(\varepsilon\) for Authors_. ### Identification The first group of commands discussed here are those used to identify your class or package file. \NeedsTeXFormat{\format-name}}[{\release-date}] This command tells TeX that this file should be processed using a format with name \format-name. You can use the optional argument \release-date to further specify the earliest release date of the format that is needed. When the release date of the format is older than the one specified a warning will be generated. The standard \format-name is LaTeX2e. The date, if present, must be in the form yyyy-mm-dd. Example:WeedsTeXFormat{LaTeX2e}[2022-06-01] People often don't know what date to put here. For the kernel, you can find out the right one by consulting changes.txt and select the release date of a new feature you are interested in. This is slightly different for packages as they are released throughout the year: you will need to consult their change history. ``` \ProvidesClass{\(\_\)class-name\}I{release-info\} \ProvidesPackage{\(\_\)package-name\}I{release-info\} ``` This declares that the current file contains the definitions for the document class \(\_\)class-name\()\) or package \(\_\)package-name\()\). The optional \(\_\)release-info\()\), if used, must contain: * the release date of this version of the file, in the form yyyy-mm-dd; * optionally followed by a space and a short description, possibly including a version number. The above syntax must be followed exactly so that this information can be used by \LoadClass or \documentclass (for classes) or \RequirePackage or \usepackage (for packages) to test that the release is not too old. The whole of this \(\_\)release-info\()\) information is displayed by \listfiles and should therefore not be too long. Example: ``` \ProvidesClass{article}[2022-06-01 v1.0 Standard LaTeX class] \ProvidesPackage{ifthen}[2022-06-01 v1.0 Standard LaTeX package] ``` This is similar to the two previous commands except that here the full filename, including the extension, must be given. It is used for declaring any files other than main class and package files. Example: ``` \ProvidesFile{Tlenc.def}[2022-06-01 v1.0 Standard LaTeX file] ``` Note that the phrase Standard LaTeX **must not** be used in the identification banner of any file other than those in the standard LaTeX distribution. ### Loading files This group of commands can be used to create your own document class or package by building on existing classes or packages. \RequirePackage[\(options-list)]{\(\package-name)}[\(release-info)] \RequirePackageWithOptions{(package-name)}[\(release-info)] ``` Packages and classes should use these commands to load other packages. The use of \RequirePackage is the same as the author command \usepackage. Examples: \RequirePackage{ifthen}[2022-06-01] \RequirePackageWithOptions{graphics}[2022-06-01] \LoadClass[(options-list)]{(class-name)}[\(release-info)] \LoadClassWithOptions{(class-name)}[\(release-info)] ``` These commands are for use _only_ in class files, they cannot be used in packages files; they can be used at most once within a class file. The use of \LoadClass is the same as the use of \documentclass to load a class file. Examples: \LoadClass{article}[2022-06-01] \LoadClassWithOptions{article}[2022-06-01] The two WithOptions versions simply load the class (or package) file with exactly those options that are being used by the current file (class or package). See below, in 4.5, for further discussion of their use. ### Delaying code As noted earlier, a sophisticated hook system is available and described in lithooks. Here, we document a small set of convenient short names for common hooks. These first two commands are also intended primarily for use within the \(code\) argument of \DeclareOption or \DeclareOption*. \AtEndOfClass{(code)} \AtEndOfPackage{(code)} These commands declare \(code\) that is saved away internally and then executed after processing the whole of the current class or package file. Repeated use of these commands is permitted: the code in the arguments is stored (and later executed) in the order of their declarations. \AtBeginDocument{(code)} \AtEndDocument{(code)} These commands declare \(code\) to be saved internally and executed while LaTeX is executing \begin{document} or \end{document}. The \(\langle\)_code_\(\rangle\) specified in the argument to \AtBeginDocument is executed near the end of the \begin{document} code, _after_ the font selection tables have been set up. It is therefore a useful place to put code which needs to be executed after everything has been prepared for typesetting and when the normal font for the document is the current font. The \AtBeginDocument hook should not be used for code that does any typesetting since the typeset result would be unpredictable. The \(\langle\)_code_\(\rangle\) specified in the argument to \AtEndDocument is executed at the beginning of the \end{document} code, _before_ the final page is finished and before any leftover floating environments are processed. If some of the \(\langle\)_code_\(\rangle\) is to be executed after these two processes, you should include a \clearpage at the appropriate point in \(\langle\)_code_\(\rangle\). Repeated use of these commands is permitted: the code in the arguments is stored (and later executed) in the order of their declarations. ### Creating and using keyval options As with any key-value input, using key-value pairs as package or class options has two parts: creating the key options and setting (using) them. Options created in this way _may_ be used after package loading as general key-value settings: this will depend on the nature of the underlying code. \DeclareKeys[(_family_)] \{\(\langle\)_declarations_\(\rangle\}\) This command creates a series of options from a comma-separated \(\langle\)_declarations_\(\rangle\) list. Each entry in this list is a key-value pair, with the \(\langle\)_key_\(\rangle\) having one or more \(\langle\)_properties_\(\rangle\). A small number of 'basic' \(\langle\)_properties_\(\rangle\) are described below. The full range of properties, provided by 13keys, can also be used for more powerful processing. See interface3 for the full details. The basic properties provided here are *.code -- execute arbitrary code *.if -- sets a TeX \if... switch *.ifnot -- sets an inverted TeX \if... switch *.store -- stores a value in a macro * defines whether the option can be given only when loading (load), in the preamble (preamble) or has no limitation on scope (general) The part of the \(\langle\)_key_\(\rangle\) before the \(\langle\)_property_\(\rangle\) is the \(\langle\)_name_\(\rangle\), with the \(\langle\)_value_\(\rangle\) working with the \(\langle\)_property_\(\rangle\) to define the behaviour of the option. For example, with }DeclareKeys[mpkg] { draft.if = @mypkg@draft, draft.usage = preamble, name.store = \@mypkg@name, name.usage = load, second-name.store = \@mypkg@other@name } three options would be created. The option draft can be given anywhere in the preamble, and will set a switch called \if@mypkg@draft. The option name can only be given during package loading, and will save whatever value it is given in \@mypkg@name. Finally, the option second-name can be given anywhere, and will save its value in \@mypkg@other@name. Keys created _before_ the use of \ProcessKeyOptions act as package options. \DeclareUnknownKeyHandler[\(\langle\)_family_\(\rangle\)] The command \DeclareUnknownKeyHandler may be used to define the behavior when an undefined key is encountered. The \(\langle\)_code_\(\rangle\) will receive the unknown key name as #1 and the value as #2. These can then be processed as appropriate, e.g. by forwarding to another package. \ProcessKeyOptions[\(\langle\)_family_\(\rangle\)] The \ProcessKeyOptions function is used to check the current option list against the keys defined for \(\langle\)_family_\(\rangle\). Global (class) options and local (package) options are checked when this function is called in a package. \SetKeys[\(\langle\)_family_\(\rangle\)] {\(\langle\)_keyvals_\(\rangle\)} Sets (applies) the explicit list of \(\langle\)_keyvals_\(\rangle\) for the \(\langle\)_family_\(\rangle\): if the latter is not given, the value of \@currname is used. This command may be used within a package to set options before or after using \ProcessKeyOptions. ### Passing options around These two commands are also very useful within the \(\langle\)_code_\(\rangle\) argument of options. \PassOptionsToPackage {\(\langle\)_options-list_\(\rangle\)} {\(\langle\)_package-name_\(\rangle\)} \PassOptionsToClass {\(\langle\)_options-list_\(\rangle\)} {\(\langle\)_class-name_\(\rangle\)} The command \PassOptionsToPackage passes the option names in \(\langle\)_options-list_\(\rangle\) to package \(\langle\)_package-name_\(\rangle\). This means that it adds the \(\langle\)_option-list_\(\rangle\) to the list of options used by any future \RequirePackage or \usepackage command for package \(\langle\)_package-name_\(\rangle\). Example:\PassOptionsToPackage{foo,bar}{fred} \RequirePackage[baz]{fred} is the same as: \RequirePackage[foo,bar,baz]{fred} Similarly, \PassOptionsToClass may be used in a class file to pass options to another class to be loaded with \LoadClass. The effects and use of these two commands should be contrasted with those of the following two (documented above, in 4.2): \LoadClassWithOptions \RequirePackageWithOptions The command \RequirePackageWithOptions is similar to \RequirePackage, but it always loads the required package with exactly the same option list as that being used by the current class or package, rather than with any option explicitly supplied or passed on by \PassOptionsToPackage. The main purpose of \LoadClassWithOptions is to allow one class to simply build on another, for example: \LoadClassWithOptions{article} This should be compared with the slightly different construction \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article} \ProcessOptions} relax \LoadClass{article} As used above, the effects are more or less the same, but the first is a lot less to type; also the \LoadClassWithOptions method runs slightly quicker. If, however, the class declares options of its own then the two constructions are different. Compare, for example: \DeclareOption{landscape}{\@landscapetrue} \ProcessOptions}relax \LoadClassWithOptions{article} with: \DeclareOption{landscape}{\@landscapetrue} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article} \ProcessOptions}relax \LoadClass{article} In the first example, the article class will be loaded with option landscape precisely when the current class is called with this option. By contrast, in the second example it will never be called with option landscape as in that case article is passed options only by the default option handler, but this handler is not used for landscape because that option is explicitly declared. ### Safe file commands These commands deal with file input; they ensure that the non-existence of a requested file can be handled in a user-friendly way. ``` \IfFileExists{\(\mathit{file\_name}\)}{\(\langle\mathit{true}\rangle\)}{\(\langle\mathit{false}\rangle\)} ``` If the file exists then the code specified in \(\langle\mathit{true}\rangle\) is executed. If the file does not exist then the code specified in \(\langle\mathit{false}\rangle\) is executed. This command does _not_ input the file. ``` \InputIfFileExists{\(\langle\mathit{file\_name}\rangle\)}{\(\langle\mathit{true}\rangle\)}{\(\langle\mathit{false}\rangle\)} ``` This inputs the file \(\langle\mathit{file\_name}\rangle\) if it exists and, immediately before the input, the code specified in \(\langle\mathit{true}\rangle\) is executed. If the file does not exist then the code specified in \(\langle\mathit{false}\rangle\) is executed. It is implemented using \IfFileExists. ### Reporting errors, etc These commands should be used by third party classes and packages to report errors, or to provide information to authors. ``` \ClassError{(\langle\mathit{class\_name}\rangle\)}{\(\langle\mathit{error\_text}\rangle\)}{\(\langle\mathit{help\_text}\rangle\)}{\(\langle\)PackageError\(\langle\mathit{package\_name}\rangle\)}{\(\langle\mathit{error\_text}\rangle\)}{\(\langle\mathit{help\_text}\rangle\)} ``` These produce an error message. The \(\langle\mathit{error\_text}\rangle\) is displayed and the \(\mathcal{T}\) error prompt is shown. If the user types h, they will be shown the \(\langle\mathit{help\_text}\rangle\). Within the \(\langle\mathit{error\_text}\rangle\) and \(\langle\mathit{help\_text}\rangle\): \(\backslash\)protect can be used to stop a command from expanding; \(\backslash\)MessageBreak causes a line-break; and \(\backslash\)space prints a space. Note that the \(\langle\mathit{error\_text}\rangle\) will have a full stop added to it, so do not put one into the argument. For example: ``` \newcommand{\foo}{F00} \PackageError{ethel}{\% Your hovercraft is full of eels,\MessageBreak and \protect\foo\space is \foo }{\% Oh dear! Something's gone wrong.\MessageBreak \space\space Try typing \space \space \space tryturns \space to proceed, ignoring \protect\foo. } ``` produces this display:: ! Package ethel Error: Your hovercraft is full of eels, (ethel) and \foo is F0O. See the ethel package documentation for explanation. If the user types h, this will be shown: Oh dear! Something's gone wrong. Try typing <return> to proceed, ignoring \foo. \ClassWarning {_class-name_} {_warning-text_} \PackageWarning {_package-name_} {_warning-text_} \ClassWarningNoLine {_class-name_} {_warning-text_} \PackageWarningNoLine {_package-name_} {_warning-text_} \ClassInfo {_class-name_} {_info-text_} \PackageInfo {_package-name_} {_info-text_} \PackageInfo {_package-name_} {_info-text_} \The four Warning commands are similar to the error commands, except that they produce only a warning on the screen, with no error prompt. The first two, Warning versions, also show the line number where the warning occurred, whilst the second two, WarningNoLine versions, do not. The two Info commands are similar except that they log the information only in the transcript file, including the line number. There are no NoLine versions of these two. Within the \(\langle\)_warning-text_\(\rangle\) and \(\langle\)_info-text_\(\rangle\): \(\backslash\)protect can be used to stop a command from expanding; \(\backslash\)MessageBreak causes a line-break; and \(\backslash\)space prints a space. Also, these should not end with a full stop as one is automatically added. ## 5 Miscellaneous commands, etc. ### Layout parameters \paperheight \paperwidth These two parameters are usually set by the class to be the size of the paper being used. This should be actual paper size, unlike \textwidth and \textheight which are the size of the main text body within the margins. ### Case changing \MakeUppercase {_text_} MakeLowercase {_text_} MakeTitlecase {_text_} As described in usrguide, case changing for text should be carried out usingthe commands MakeUppercase, MakeLowercase and MakeTitlecase. If you need to change the case of programmatic material, the team strongly suggest using the L3 programming layer commands in the str module. If you do not wish to do this, you should use the TeX \uppercase and \lowercase primitives _in this situation only_. ### Better user-defined math display environments ``` \ignorespacesaaferend ``` Suppose that you want to define an environment for displaying text that is numbered as an equation. A straightforward way to do this is as follows: ``` \newenvironment{texteqn} {begin{equation} \begin{minipage}{0.9\linewidth} \{end{minipage} \end{equation} ``` However, if you have tried this then you will probably have noticed that it does not work perfectly when used in the middle of a paragraph because an inter-word space appears at the beginning of the first line after the environment. You can avoid this problem using \ignorespacesafterend; it should be inserted as shown here: ``` \newenvironment{texteqn} {begin{equation} \begin{minipage}{0.9\linewidth} \{end{minipage} \end{equation} \ignorespacesafterend} ``` This command may also have other uses. ### Normalising spacing ``` \normalsfcodes ``` This command should be used to restore the normal settings of the parameters that affect spacing between words, sentences, etc. An important use of this feature is to correct a problem, reported by Donald Arseneau, that punctuation in page headers has always (in all known TeX formats) been potentially wrong whenever a page break happens while a local setting of the space codes is in effect. These space codes are changed by, for example, the command \frenchspacing) and the verbatim environment. It is normally given the correct definition automatically in \begin{document} and so need not be explicitly set; however, if it is explicitly made non-empty in a class file then automatic default setting will be over-ridden. ### Querying localisation Localisation information is needed to customise a range of outputs. The LaTeX kernel does not itself manage localisation, which is well-served by the bundles babel and polyglossia. To allow the kernel and other packages to access the current localisation information provided by babel or polyglossia, the command \BCPdata is defined by the kernel. The initial kernel definition expands to tag parts for en-US, as the kernel does not track localisation but does start out with a broadly US English setup. However, if babel or polyglossia are loaded, it is redefined expand to the BCP-47 information from the appropriate package. The supported arguments are the BCP-47 tag breakdowns: * tag The full BCP-47 tag (e.g. en-US) * language (e.g., de) * region (e.g., AT) * script (e.g., Latn) * variant (e.g., 1901) * extension.t (transformation, e.g., en-t-ja) * extension.u (additional locale information, e.g., ar-u-nu-latn) * extension.x (private use area, e.g., la-x-classic) The information for the _main_ language for a document is be provided if these are prefixed by main., e.g. main.language will expand to the main language even if another language is currently active. In addition to the tag breakdown, the following semantic arguments are supported * casing The tag for case changing, e.g. el-x-iota could be selected rather than el to select a capital adscript iota on uppercasing an _ypogegrammeni_ For example, the case changing command \MakeUppercase is (conceptually) defined as \ExpandArgs{e}\MakeUppercaseAux{\BCPdata{casing}}{#1} where #1 is the user input and the first argument to \MakeUppercaseAux takes two arguments, the locale and input text. ## 6 Commands superseded for new material A small number of commands were introduced as part of LaTeX 2\(\varepsilon\) in the mid-1990s, are widely used but have been superseded by more modern methods. These are covered here as they are likely to be encountered routinely in existing classes and packages. ### Defining commands The *-forms of these commands should be used to define commands that are not, in TeX terms, long. This can be useful for error-trapping with commands whose arguments are not intended to contain whole paragraphs of text. ``` \DeclareRobustCommand{{cmd}}[{num}][{default}]{{definition}} DeclareRobustCommand*{{cmd}}[{num}][{default}]{{definition}} ``` This command takes the same arguments as \newcommand but it declares a robust command, even if some code within the \(\langle\)_definition_\(\rangle\) is fragile. You can use this command to define new robust commands, or to redefine existing commands and make them robust. A log is put into the transcript file if a command is redefined. For example, if \seq is defined as follows: ``` \DeclareRobustCommand{\seq}[2][n]{% \ifmmode #1_{1}\ldots#1_{#2}% \else \PackageWarning{fred}{You can't use \protect\seq\space in text}% \fi } ``` Then the command \seq can be used in moving arguments, even though \ifmmode cannot, for example: ``` \section{Stuffaboutsequences$\seq{x}$} ``` Note also that there is no need to put a \relax before the \ifmmode at the beginning of the definition; this is because the protection given by this \relax against expansion at the wrong time will be provided internally. ``` \CheckCommand{{cmd}}[{num}][{default}]{{definition}} CheckCommand*{{cmd}}[{num}][{default}]{{definition}} ``` This takes the same arguments as \newcommand but, rather than define \(cmd\), it just checks that the current definition of \(cmd\) is exactly as given by \(\langle\)_definition_\(\rangle\). An error is raised if these definitions differ. This command is useful for checking the state of the system before your package starts altering the definitions of commands. It allows you to check, in particular, that no other package has redefined the same command. ### Option declaration The following commands deal with the declaration and handling of options to document classes and packages using a classical'simple text' approach. Every option name must be a 'LaTeX name'. There are some commands designed especially for use within the \(\langle code\rangle\) argument of these commands (see below). \DeclareOption\(\{\langle\)option-name\(\rangle\}\)\(\{\langle code\rangle\}\) This makes \(\langle\)option-name\(\rangle\) a 'declared option' of the class or package in which it is put. The \(\langle code\rangle\) argument contains the code to be executed if that option is specified for the class or package; it can contain any valid LaTeX\(2_{\varepsilon}\) construct. Example: \DeclareOption\(\{\)twoside\(\}\{\)\(\emptyset\)twosidetrue\(\}\) This declares the \(\langle code\rangle\) to be executed for every option which is specified for, but otherwise not explicitly declared by, the class or package; this code is called the 'default option code' and it can contain any valid LaTeX\(2_{\varepsilon}\) construct. If a class file contains no \DeclareOption* then, by default, all specified but undeclared options for that class will be silently passed to all packages (as will the specified and declared options for that class). If a package file contains no \DeclareOption* then, by default, each specified but undeclared option for that package will produce an error. ### Commands within option code These two commands can be used only within the \(\langle code\rangle\) argument of either \DeclareOption or \DeclareOption*. Other commands commonly used within these arguments can be found in the next few subsections. \CurrentOption This expands to the name of the current option. \OptionNotUsed This causes the current option to be added to the list of 'unused options'. ### Option processing \ProcessOptions This command executes the \(\langle code\rangle\) for each selected option. We shall first describe how \ProcessOptions works in a package file, and then how this differs in a class file. To understand in detail what \ProcessOptions does in a package file, you have to know the difference between _local_ and _global_ options. * **Local options** are those which have been explicitly specified for this particular package in the \(_options_) argument of any of these: \PassOptionsToPackage{<options>} \usepackage[<options>] \RequirePackage[<options>] * **Global options** are any other options that are specified by the author in the \(_options_) argument of \documentclass[<options>]. For example, suppose that a document begins: \documentclass[german,twocolum]{article} \usepackage{gerhardt} whilst package gerhardt calls package fred with: \PassOptionsToPackage{german,dvips,a4paper}{fred} \RequirePackage[errorshow]{fred} then: * fred's local options are german, dvips, a4paper and errorshow; * fred's only global option is twocolumn. When \ProcessOptions is called, the following happen. * _First_, for each option so far declared in fred.sty by \DeclareOption, it looks to see if that option is either a global or a local option for fred: if it is then the corresponding code is executed. This is done in the order in which these options were declared in fred.sty. * _Then_, for each remaining _local_ option, the command \ds@<option> is executed if it has been defined somewhere (other than by a \DeclareOption); otherwise, the 'default option code' is executed. If no default option code has been declared then an error message is produced. This is done in the order in which these options were specified. Throughout this process, the system ensures that the code declared for an option is executed at most once. Returning to the example, if fred.sty contains: \DeclareOption{dvips}{\typeout{DVIPS}} \DeclareOption{german}{\typeout{GERMAN}} \DeclareOption{french}{typeout{FRENCH}} \DeclareOption*{\PackageWarning{fred}{Unknown '\CurrentOption'}} \ProcessOptions\relaxthen the result of processing this document will be: ``` DVIPS GERMAN PackagefredWarning:Unknown'a4paper'. PackagefredWarning:Unknown'erorshow'. ``` Note the following: * the code for the dvips option is executed before that for the german option, because that is the order in which they are declared in fred.sty; * the code for the german option is executed only once, when the declared options are being processed; * the a4paper and errorshow options produce the warning from the code declared by DeclareOption* (in the order in which they were specified), whilst the twocolumn option does not: this is because twocolumn is a global option. In a class file, ProcessOptions works in the same way, except that: _all_ options are local; and the default value for DeclareOption* is \OptionNotUsed rather than an error. Note that, because \ProcessOptions has a *-form, it is wise to follow the non-star form with \relax, as in the previous examples, since this prevents unnecessary look ahead and possibly misleading error messages being issued. ``` \ProcessOptions* ``` This is like \ProcessOptions but it executes the options in the order specified in the calling commands, rather than in the order of declaration in the class or package. For a package this means that the global options are processed first. ``` \ExecuteOptions{(options-list)} ``` It can be used to provide a 'default option list' just before \ProcessOptions. For example, suppose that in a class file you want to set up the default design to be: two-sided printing; 11pt fonts; in two columns. Then it could specify: ``` \ExecuteOptions{11pt,twoside,twocolumn} ```
skeycommand
ctan
The skeycommand Package(r) Version 0.4 This package has been superseded by the key command and key environment commands of the 1txkeys package. It is maintained only for the sake of those already using it. Prospective users should instead employ the facilities of the ltxkeys package. Ahmed Musa(r) Preston, Lancashire, UK The skeycommand package provides tools for defining LaTeX-style commands and environments using parameters and keys together. The advantages of keys over parameters include the facts that the former aren't limited to nine but can rise as desired by the user, and keys are much easier to match to their values than parameters to arguments, especially if the parameters are many. Moreover, keys can have natural functions. The design approach and user interfaces in the skeycommand package differ from those found in the keycommand package. This package also provides the Uneutwooptcmd and meuwooptcmicron macros for defining new commands and environments with two options/optional arguments. At both key command definition and invocation times there is no reference by the user to the semantics of key parsing and management. All the complex semantics and calculations involved in defining and setting keys are transparent to the user. The user of the skeycommand package has access to some of the machinery of ltxkeys package (including the pointer mechanism) at the much lesser cost of worrying only about the key names and their values. Native boolean keys are automatically recognized and handled appropriately. However, because of the need to keep the user interface simple, choice and style keys aren't available in this package. ## License This work (i.e., all the files in the skeycommand package bundle) may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3 of this license or any later version. The LPPL maintenance status of this software is 'author-maintained.' This software is provided 'as it is,' without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. (c) MMX Here, * \(\langle\texttt{cmd}\rangle\) is the new control sequence; \(\langle\texttt{env}\rangle\) is the new environment name. * \(\langle\texttt{mp}\rangle\) is the prefix for macros deriving from the defined keys whose values will be used in the new command or environment (this is called the _macro prefix_ in the parlance of keys). If you don't supply the optional \(\langle\texttt{mp}\rangle\), the package will use the first three letters of the key command or environment name, excluding the escape character but including an added 'at sign' (\(\mathfrak{e}\)). The aim of the default 'at sign' is to aid the visual separation of key names from macro prefixes. * \(\langle\texttt{keyval}\rangle\) is the key-value list [e. g., (keya=valuea, keyb=valueb)]. * \(\langle\texttt{narg}\rangle\) is the number of parameters/arguments for the new command or environment (excluding the keys), as you would normally enter it in \newcommand and \newenvironment. * \(\langle\texttt{afft1}\rangle\) is the default value for your optional argument (normally the first argument in \newcommand and \newenvironment). * \(\langle\texttt{defn}\rangle\) is the replacement text (as in \newcommand and \newenvironment). **Note 2.1**: The number of parameters (\(\langle\texttt{narg}\rangle\)) for the new command or environment is limited to eight (8), and not the nine (9) that TeX allows. The ninth one is taken up by the keys. Indeed, we could have designed \newkeycmd, \renewkeycmd, \newkeyevniron, \renewkeyevniron to take nine parameters (apart from the keys) but the need for parameters is greatly diminished by the theoretically limitless number of keys that each command can have. Please note the angle brackets surrounding \(\langle\texttt{mp}\rangle\), and the parentheses surrounding \(\langle\texttt{keyval}\rangle\) in the above syntaxes. The \(\langle\texttt{mp}\rangle\) can't be empty (i. e., don't enter <>) because it will be used by the package to build unique names for the macros that will hold the key values. You can choose not to enter anything for \(\langle\texttt{mp}\rangle\), i. e., no angled brackets at all. In this case the package will happily use the default prefix <xxx@>, where 'xxx' represents the first three letters of the new command or environment name, excluding the escape character. Also, \(\langle\texttt{keyval}\rangle\) can't be empty: if it was empty, then we should wonder why you're using key commands instead of TeX's \newcommand and \newenvironment. In \(\langle\texttt{defn}\rangle\), you refer to your arguments in the normal way. You refer to the values of the keys using macros whose first three characters (after the escape character) are the \(\langle\texttt{mp}\rangle\) or, if \(\langle\texttt{mp}\rangle\) is not supplied, the first three letters of the declared key command (excluding the escape character). The family name of the keys defined via a key command is the key command name itself (without the escape character)--but the user is not required to know anything about such jargons as 'key families.' The package uses this internally in developing the keys. The key prefix is always 'KV.' If any of your key values contains parentheses, simply enclose them in braces, to avoid confusing them with \(\langle\texttt{keyval}\rangle\) list. The starred (\(\star\)) variants give'short' macros, while the plain (unstarred) variants yield 'long' macros, in the sense usually understood in TeX. The optional \(\langle\texttt{mp}\rangle\) will be useful if you fear clashes with previously defined key commands. Although, to be defined, key commands must be definable, two key commands may have their first three or four characters identical, thereby leading to clashes of their key-value prefixes. ### Final tokens of every environment The user can add some tokens to the very end of every subsequent environment by declaring those tokens in \skceveryeoe, which by default contains only TeX's \ignorespacesafterend, that is, the \skeycommand package automatically issuesIt is important to note that new tokens are prepended (not appended) to the hook that underlies \skceveryeoe, such that by default \ignorespacesafetrend always comes last in the list. You can empty the token list \skceveryeoe by issuing \skceveryeoe{} and rebuild the list afresh, still by prepending elements to it. \skceveryeoe isn't actually a token list register, but has been designed to behave like one. It is safe to issue \skceveryeoe{(token)} and/or \skceveryeoe{} in the pre-code part of the environment. The following example illustrates this point. Example: \newkeyenviron \newkeyenviron*{testenv}<mp@>(xwidth=2cm,width=1.5cm, bool=false,body=null,author=NULL){% \centering\fbox{\mp@xwidth}{\mp@body}} \ifmp@bool\color{red}\fi \fbox{\parbox{\mp@ywidth}{\mp@body}}% \normalcolor \skceveryeoe{\% \skceveryeoe{\ignorespacesafetrend}% \skceveryeoe{\ndgraft}{\bselineskip} \centerline{\itshape}{upp@author}} \def\testmacro##{aaa#1bbb}% just to test parameter use \f{% \def\testmacro##1{xxx##1yyyy}% \begin{document} \begin{testenv}(xwidth=5cm,width=4cm,bool=true, author={Corelius Tacitus \textbackslash{textup}((55--120^AD))},body={% \ Love of fame is the last thing even learned men can bear \% \end{document} Result of example code \begin{tabular}{|l|l|} \hline Love of fame is the last thing even learned men can bear to be parted from. & Love of fame is the last thing even learned men can bear to be parted from. \\ \hline \end{tabular} ### Invoking new key commands and environments The syntaxes for calling new key commands and environments are as follows: Invoking commands and environments \cmd[(arg1)]{(arg2)}...{(argn)}(\keyval)) \begin{tabular}{|l|} \begin{tabular}{|l|} \hline Invoking commands and environments \\ \hline \textbackslash{text}((arg1)]{(arg2)}...{(argn)}(\keyval)) \\ \end{tabular} \begin{tabular}{|l|} \hline \textbackslash{text}((arg1)]{(arg2)}...{(argn)}(\keyval)) \\ \end{tabular} \begin{tabular}{|l|} \hline \end{tabular} where \cmd and env have been previously defined using key command and key environment. You refer to your arguments using parameter number one #1 onwards, up to a maximum of ##8 (yes, #8,not #9). Here, \(\langle\)keyval\(\rangle\) (including the parenthesis) are optional arguments: you can omit them if you want to use the values of the keys set at key command definition time. Using keys is preferable to using parameters: you don't have to match parameters to arguments and, in principle, there is no limit to the number of keys that are permissible. #### 2.4 Commands and environments with two optional arguments The skeycommand package uses the following macros internally. They can be used to define new commands and environments with two optional arguments. Their philosophy, intent, and use syntaxes differ from those of the twoopt package. They may be useful to some users in a few circumstances, but I recommend the use of the above key commands in all instances. ``` Newmacros:\newtwooptcmd,\newtwooptenviron,etc ``` ``` newtwooptcmd(cmd[(narg)][(dft1)]{(defn)} newtwooptcmd*(cmd)[(narg)][(dft1)]{(defn)} ``` ``` newtwooptcmd*(cmd)[(narg)][(dft1)]{(defn)} ``` ``` newtwooptenviron(cmd[(narg)][(dft1)]{(defn)} ``` ``` newtwooptenviron*(cmd)[(narg)][(dft1)]{(defn)} ``` ``` newtwooptenviron*(cmd)[(narg)][(dft1)]{(defn)} ``` ``` \(\langle\)narg\(\rangle\) is the total number of arguments, including the first and second optional arguments. Where are the second optional arguments here, you might be wondering? The second optional argument is usually empty and doesn't appear at command definition time. The second optional argument isn't the second argument of your command (as in twoopt package), but the last. At command invocation, if you don't supply a value for the second optional argument, the command will assume it to be empty. But how do you supply a value for the second optional argument? The next section shows how. #### 2.4.1 Invoking commands and environments with two optional arguments The syntaxes for calling commands and environments with two optional arguments are as follows: ``` Macro:Commandsandenvironmentswithtwooptionalarguments ``` ``` \cmd[(1stoptrg)]{(arg2)}...{\(\langle\)narg\(\rangle\)}{\(\langle\)2ndoptrg\(\rangle)} \begin{enumv}[(1stoptrg)]{(arg2)}...{\(\langle\)narg\(\rangle\)}{\(\langle\)2ndoptrg\(\rangle)} environmentbody \end{enumv} ``` If \(\langle\)2ndoptrg\(\rangle\) is empty at command or environment invocation, the command or environment will assume it to be empty. Now you can see the conceptual link between \newtwooptcmd (and friends) and \newkeycmd (and friends). ## 3 Examples The source codes for the following examples are available in the accompanying user guide (file skeycommand-guide.tex). Result of example code **G. H. Hardy vs. Srinivasa Ramanujan (1920)** Hardy: Srinivasa, can you see that number from here, the one on that taxi cab? Ramanujan: I can see it, it is 1729. Hardy: What a dull registration number to have on your vehicle? Ramanujan: No, it is a very interesting number. Hardy: What is interesting about it? Ramanujan: It is the smallest number expressible as a sum of two cubes in two different ways. Hardy: What are the different ways? If I write a tune you all say it's commonplace---if I don't, you all say it's rot.% }% }% }end{Quote} 230\begin{Quote}(left=4Opt,right=4Opt,mode=false, whoby={ALBERT EINSTEIN},source={The World As I See It})% {ifmp@mode\color{red}\else\color{blue}\}\{fi If you want to find out anything from the theoretical physicists about the methods they use, I advise you to stick closely to one principle: don't listen to their words, fix your attention on their deeds.% }% }end{Quote} Result of example code "An author writing an article for publication in TUGboat is encouraged to create it on a computer file and submit it on magnetic tape." }B. BEETON, _How to Prepare a File For Publication in TUGboat_ (1981) Source: The TeXBook "The printer should refuse to employ wandering men, foreigners who, after having committed some grievous error, can easily disappear and return to their own country." }HIBERONYMUS HORNSCHUCH (1608) Source: The TeXBook "If I write a tune you all say it's commonplace--if I don't, you all say it's rot." }EDWARD ELGAR (1898) Source: Letter to A. J. Jaeger "If you want to find out anything from the theoretical physicists about the methods they use, I advise you to stick closely to one principle: don't listen to their words, fix your attention on their deeds." } **Version 0.3** [2010/05/21] Introduced \skceveryeoe **Version 0.2** [2010/05/20] Addressed the case of \newkeycmd without parameters **Version 0.1** [2010/05/05] First public release
mpost_output
ctan
## Copyright Copyright (c) Dave Bone 1998 - 2015_mpost_output_**Grammar.** Write out the _cweb_'s representation of the grammar's code and _mpost_'s railroad diagrams. These appropriate files have the grammar's name along with extension "w" for _cweave_ to compile and extension "mp" for _mpost_ to draw from. Enjoy the art work. All the grammar's vocabulary are cross referenced to accomodate the grammar writer. The railroad diagrams show left recursion and where the subrule has appropriate syntax directed code, it redraws the subrule with each element's position number below it. This aids in the writing of syntax directed code when individual parameters are referenced by use of the _sf_ stack frame structure. Each element within the stack frame has a naming convention of _p#___ where the number sign is the element's position within the subrule sentence relative to 1. Fodder to this grammar is provided by the tree container doing a prefix traverse. Why a prefix traverse? The parent node allowed me to declare the _mpost_ variables before their use. Caveat: Grammar c++ comments must observe _cweave_ dictums: underscored items like variable names must be enclosed with \(|\) and the number sign "#" must use its literal of backslash #. Without these observances, _pdftex_ will honk. ## 3 Fsm Cmpost_output class. ### Cmpost_output constructor directive. ( Cmpost_output constructor directive 4) = MPOST_CWEB_LOAD_XLATE_CHRS(this); ## 5 Cmpost_output op directive. Due to a MS 2005 Visual Studio defficiency, part of the ctor's initialization is included here instead of all being done by MPOST_CWEB_EMIT_PREFIX_CODE. The reason is noted in the documentation of _o2externs_. \(\langle\)Cmpost_output op directive 5\(\rangle\equiv\) _no_subrules_per_rule_.push_back\((0)\); **time_t**_theTime_\(=\)time\((0)\); **char**\(*\)_cTime_\(=\)time\((\&\)_theTime_\()\); **gened_date_time_\(+\)\(=\)string\((\)cTime\()\)**; **int**\(n=\)_gened_date_time_\(\_\)_find\((\)'\(\backslash\)n'\()\); _gened_date_time\([n]\)\(=\)'\(\cup\)'_; _mp_dimension_. \(+\)\(=\)"\(\_\)abcdefghijklmnopqrstuvwxyz\({}^{\ast}\); _w_fig_no_\(=\)\(0\); _rule_def_\(=\)\(0\); _subrule_def_\(=\)\(0\); _rule_no_\(=\)\(0\); _subrule_no_\(=\)\(0\); _elem_no_\(=\)\(0\); _no_of_rules_\(=\)\(0\); _no_of_subrules_\(=\)\(0\); _mp_filename_\(+\)\(=\)_grammar_filename_prefix_\(c\_str\)\(()\); _mp_filename_\(+\)\(=\)".mp"; _omp_file_open_(_mp_filename_\(c\_str\)\(()\),_ios_base\(\,\)\( ## 6 Cmpost_output user-declaration directive \(\langle\)Cmpost_output user-declaration directive \(\;\rangle\equiv\) \(\langle\)**public**: **char**_big_buf_[BIG_BUFFER_32K]; _std_::_map_\(<\)**int**\(\;\), _std_::_string_\(>\)_xlated_names_.; _std_::_vector_\(<\)**int\(>\)_no_subrules_per_rule_.; \(std::\)_string_gened_date_time_.; \(std::\)_string_mp_filename_.; \(std::\)_ofstream_omp_file_.; \(std::\)_string_w_filename_.; \(std::\)_string_w_index_filename_.; \(std::\)_ofstream_ow_file_.; \(std::\)_ofstream_ow_index_file_.; \(std::\)_ofstream_ow_err_file_.; \(std::\)_ofstream_ow_lrk_file_.; \(std::\)_string_grammar_filename_prefix_.; \(std::\)_string_fq_filename_noext_.; **int**_w_fig_no_.; **int**_rule_no_.; **int**_subrule_no_.; **int**_elem_no_.; **int**_no_of_rules_.; **int**_no_of_subrules_.; \(std::\)_string_rule_name_.; \(std::\)_string_elem_name_.; \(rule\_def\)\(*\)_rule_def_.; \(T\_\)_subrule_def_.; \(std::\)_string_mp_dimension_.; **static**: **void**_MPOST_CWEB_gen_dimension_name_(_Cmpost_output_*_Fsm_,_std::_string_\(\&\)_Mp_obj_name_,**int**_Dimension_); **static**: **void**_MPOST_CWEB_calc_mp_obj_name_(_Cmpost_output_*_Fsm_,_std::_string_\(\&\)_Mp_obj_name_,**int**_Elem_no_); **static**: **void**_MPOST_CWEB_wrt_mp_rhs_elem_(_Cmpost_output_*_Fsm_,_std::_string_\(\&\)_Elem_name_, \(std::\)_string_\(\&\)_Drw_how_); **static**: **void**_MPOST_CWEB_gen_sr_elem_xrefs_(_Cmpost_output_*_Fsm_,_AST*_Subrule_tree_); **static**: **void**_MPOST_CWEB_woutput_sr_sdcode_(_Cmpost_output_*_Fsm_,_T_subrule_def_*_Subrule_def_); **static**: **void**_MPOST_CWEB_wrt_fsm_(_Cmpost_output_*_Fsm_,_T_fsm_phrase_*_Fsm_phrase_); **static**: **void**_MPOST_CWEB_wrt_rule_s_lhs_sdc_(_Cmpost_output_*_Fsm_,_rule_def_*_Rule_def_); **static**: **bool**_MPOST_CWEB_should_subrule_be_printed_(_Cmpost_output_*_Fs_,_T_subrule_def_*_Subrule_def_); **static**: **void**_MPOST_CWEB_xref_refered_T_(_Cmpost_output_*_Fsm_,_refered_T_*R_T_); **static**: **void**_MPOST_CWEB_xref_refered_rule_(_Cmpost_output_*_Fsm_,_refered_rule_*_R_rule_); **static**: **void**_MPOST_CWEB_LOAD_XLATE_CHRS_(_Cmpost_output_*_Fsm_); **static**: **void**_MPOST_CWEB_EMIT_PREFIX_CODE_(_Cmpost_output_*_Fsm_); **static**: **void**_MPOST_CWEB_wrt_T_(_Cmpost_output_*_Fsm_,_T_terminals_phrase_*_T_phrase_); **static**: **void**_MPOST_CWEB_wrt_Err_(_Cmpost_output_*_Fsm_,_T_error_symbols_phrase_*_Err_phrase_); **static**: **void**_MPOST_CWEB_wrt_Lrk_(_Cmpost_output_*_Fsm_,_T_lr1_k_phrase_*_Lrk_phrase_); \(std::\)_list_\(<\)_NS_yacco2_terminals_::_rule_def_\(*\)_>_rules_for_fs_prt_; **static**: **void**_MPOST_CWEB_crt_rhs_sym_str_(_state_element_*se,_std::_string_*_Xlated_str_); **7.** **Cmpost_output user-prefix-declaration directive.** ( Cmpost_output user-prefix-declaration directive \(\tau\)) \(\equiv\) #include "time.h" #include "o2_externs.h" extern void \(\mathit{XLATE\_SYMBOLS\_FOR\_cweave}(\mathbf{const}\ \mathbf{char}\ *\mathit{Sym\_to\_xlate},\mathbf{char}\ *\mathit{Xlated\_sym})\); extern void \(\mathbf{PR\_RULE\_S\_FIRST\_SET}(\mathit{std::ofstream}\ \&\ \mathit{Ofile},\mathit{NS\_yacco2\_terminals}::\mathit{rule\_def}\ *\mathit{Rule\_def})\); extern int\(\mathit{MPOST\_CWEB\_xlated\_symbol}(\mathbf{AST}\ *\mathit{Sym},\mathbf{char}\ *\mathit{Xlated\_sym})\); extern\(\mathit{STATES\_type}\mathbf{LR1\_STATES}\); extern\(\mathit{COMMON\_LA\_SETS\_type}\mathbf{COMMON\_LA\_SETS}\); #include "cweave_fsm.sdc.h" #include "cweave_lhs.sdc.h" #include "cweave_sdc.h" #include "cweave_T_sdc.h" **if** (_se_-_next_state_element_-_reduced_state_\(\neq 0\))_ { _find_reduced_stateno = se_-_next_state_element_-_reduced_state_-_state_no._; } } _fsm_-_MPOST_CWEB_crt_rhs_sym_str_(_se_,_&rhs_syms_str_); _sprintf_(_fsm_-_big_buff_,_w_stateno_subrule_,(_elem_pos \(\equiv 1\))? "c" : "t",_rule_name_,_rd_-_rule_no_( ), _srd_-_subrule_no_of_rule_( ),_elem_pos_,_rhs_syms_str_c_str_( ),_se_-_closure_state_-_state_no._, _(_se_-_goto_state_\(\neq 0\))? _se_-_goto_state_-_state_no._:0,_find_reduced_stateno_,_la_set_no_); _fsm_-_ow_file_\(\ll\)_fsm_-_big_buff_\(\ll\)_endl_; } _fsm_-_ow_file_\(\ll\)"}"\(\ll\)_endl_; } _KCHARPw_end = "@**_Index."; _fsm_-_ow_file_\(\ll\)_w_end \(\ll\)_endl_; _fsm_-_ow_file_\(\ll\)_close_( ); **9.** _Rgrammar_phrase_ **10.** _Rks_epi rule.** Due to technical problems with the _convertMPtoPDF_ macro, the epsilon subrule is drawn with a dot. Rks_epi **11.** _Rks_epi **12.** _Rk_rule.** (Rk subrule 1 op directive 12) \(\equiv\) _Cmpost_output \(*\)fsm_ = ( _Cmpost_output \(*\)_) _rule_info_parser_\(\rightarrow\)fsm_tbl_; WRT_CWEB_MARKER(_&fsm_-_ow_file_,_sf_-_p1_-_ast_( )); **13.**: _Rfsm_phrase_ Rfsm_phrase (Rfsm_phrase subrule 1 op directive 13) \(\equiv\)_ _Cmpost_output \(*\)fsm =_ (_Cmpost_output \(*\)_) _rule_info_parser_~fsm_tbl_; _fsm_-MPOST_CWEB_wrt_fsm_(_fsm_,_sf_-_p1_); **14.**: _Rparallel_phrase_ Rparallel_phrase (parallel-parser-phrase) 15.**: _RT_enum_phrase_ RT_enum_phrase (Rerr_phrase subrule 1 op directive 16) \(\equiv\)_ _Cmpost_output \(*\)fsm =_ (_Cmpost_output \(*\)_) _rule_info_parser_~fsm_tbl_; _fsm_-MPOST_CWEB_wrt_Err_(_fsm_,_sf_-_p1_); **17.**: _Rrc_phrase_ Rrc_phrase (rc-phrase) 18.**: _Rlr1_k_phrase_ Rlr1_k_phrase (Rlrl_k_phrase subrule 1 op directive 18) \(\equiv\)_ _Cmpost_output \(*\)fsm =_ (_Cmpost_output \(*\)_) _rule_info_parser_~fsm_tbl_; _fsm_-MPOST_CWEB_wrt_Lrk_(_fsm_,_sf_-_p1_); **19.**: _Rterms_phrase_ Rterms_phrase (Rterms_phrase subrule 1 op directive 19) \(\equiv\)_ _Cmpost_output \(*\)fsm =_ (_Cmpost_output \(*\)_) _rule_info_parser_~fsm_tbl_; _fsm_-MPOST_CWEB_wrt_T_(_fsm_,_sf_-_p1_); **20**. _Brule_phrase_rule.** Define the number of rules for _mpost_. **Rule_phrase** (Rule_phrase subrule 1 op directive 20) \(\equiv\) _Cmpost_output_\(\ast\)_fsm_ = ( _Cmpost_output_\(\ast\))_rule_info_parser_\(\rightarrow\)_fsm_tbl_.; _fsm_no_of_rules_ = _sf_-_p1_\(\rightarrow\)_rules_alphabet_()_-_size_(); KCHARP_mp_no_of_rules = "no_of_rules"_i:=_%i;"; _sprintf_(_fsm_big_buf_,_mp_no_of_rules_,_fsm_no_of_rules_); _fsm_omp_file_\(\ll\)_fsm_big_buf_\(\ll\)_end_; **21**. _Brules_rule.** **Rrules** **Rksepi** **Rksepi** **Rksepi** **Rksepi** **22**. _Brule_rule.** **Rule_def** **Rsubrules** _Rsubrules_rule. Rsubrules Rsubrule Rsubrules Rsubrules Rsubrules Rsubrule Rsubrule_def Relements ## 26 _Rsubrule_def rule._ Rsubrule_def The _eosurbule_ T has no meaning in the drawn subrule. It is just a specific end-of-subrule indicator. So it is removed from the rhs element count of the subrule for _mpost_ processing so that it does not get drawn. The balance of the logic relates to _cweb_'s document: comments about the subrule and the appropriate _mpost_ rendering. One subtlety is the forced drawing of a single subrule that also has a rule's lhs syntax directed code. Normally i save the redrawing of the subrule as the forest and the tree is the same. But having the rule syntax code requires to have the subrule directive. Without it there are 2 code directives back-to-back that honks. \(\langle\)Rsubrule_def subrule 1 op directive 26\(\rangle\equiv\) _Cmpost_output \(*\)fsm =_ (_Cmpost_output \(*\)_) _rule_info__parser____fsm_tbl__; _+fsm-w_fig_no__; _+fsm-subrule_no__; _fsm-elem_no__ =_ 0; _fsm-subrule_def__ =_ _sf__-p1__;_ **int**_no_elements = fsm-subrule_def__-no_of_elems_ () -1; **if**_(no_elements \(\equiv 0\)) no_elements =_ 1; /* epsilon subrule */ KCHARP_mp_rule_s_subrule_no_elems_ = "rule_s_subrule_no_elems_[%i][%i]:=_%i;"; _sprintf_(_fsm-big_buff__,_mp_rule_s_subrule_no_elems_,_fsm-rule_no__,_fsm-subrule_no__,_elements_); _fsm-omp_file__\(\ll\)fsm-big_buff__\(\ll\)endl_; **if**_(fsm-MPOST_CWEB_should_subrule_be_printed_(_fsm_,_fsm-subrule_def__) \(\equiv\)_false_) return; KCHARP_rname = fsm-rule_def__-rule_name_()^-_c_str_(); KCHARP_subrule_cweb = "@*%_ul%s|^s_subrule_%i. \%break\n"; **if**_((fsm-rule_def__-rule_lhs_() \(\neq 0\)) \(\vee\)(_fsm-no_of_subrules_ \(>1\))) { _sprintf_(_fsm_-big_buff__,_subrule_cweb_,_rname_,_fsm-subrule_no__); _fsm-ow_file__\(\ll\)fsm-big_buff__; **if**_(fsm-subrule_def__-cweb_marker_() \(\neq 0\)) { WRT_CWEB_MARKER(&_fsm-ow_file__,_fsm-subrule_def__-cweb_marker_()); _cout \(\ll\)"subrule's_cweb_marker_for_rule:\(\ll\)_rname \(\ll\)endl_; **else**_{ _cout \(\ll\)"no_subrule's_cweb_marker_for_rule:\(\ll\)_rname \(\ll\)endl_; **} KCHARP_subrule_cweb_diagram = "\fbreak""\convertMPtoPDF{%s.%i}{1}{1}n"; **if**_((fsm-rule_def__-rule_lhs_() \(\neq 0\)) \(\vee\)(_fsm-no_of_subrules_ \(>1\))) { _sprintf_(_fsm-big_buff__,_subrule_cweb_diagram_,_fsm-grammar_filename_prefix__c_str_(),_fsm-w_fig_no__); _fsm-ow_file__\(\ll\)fsm-big_buff__; **} _fsm-MPOST_CWEB_woutput_sr_sdcode_(_fsm_,_fsm-subrule_def__); **27**. _Relements rule._ Relements **31**: _Relement's subrule 3._ (Relement subrule 3 op directive 31) \(\equiv\) _Cmpost_output \(*\)fsm =_ (_Cmpost_output \(*\)_) _rule_info__parser__~fsm_tbl__; _+fsm_-elem_no__; **if**_(fsm_-elem_no__ \(\equiv\)1_ {_/*_epsilon */_std__::stringmp_obj_type_("Circle_solid"); _std__::stringmp_elem_name_("u"); _fsm_-_MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_,_mp_elem_name_,_mp_obj_type_); ## 32. _Relement_'s subrule 4. Why is there a re-aligning on the number of _rule_s_subrule_no_elems_? Two reasons: Due to the tree walk being top down, initially the number of items are determined by the _subrule_ - _def_ T before processing the actual subrule sentence. Due to the calling of threads, this number gets shrunk as i combine the 3 parts of the called thread into 1 item. Though it looks like a mistake in the emitted _mpost_ code, it's a slight inefficiency to manage a nice picture. This comment hold for the other version of thread call below. (Relement subrule 4 op directive 32) \(\equiv\) _Cmpost_output \(*\)fsm =_ (_Cmpost_output \(*\)_) _rule_info_parser_~fsm_tbl_; KCHARP_realign_nos = "rule_s_subrule_no_elems[%i][%i]:=_%i;"; _sprintf (fsm_big_buf_, _re_align_nos_, _fsm_rule_no_, _fsm_subrule_no_, 3); _fsm_omp_file_ \(\ll\)_fsm_big_buf_\(\ll\) "%_re-align_cnt" \(\ll\)_endl_; _+fsm_elem_no_.; _std \(::\)stringmp_obj_type_("Circle_dotted"); _std \(::\)stringmp_elem_name_; **if** (_sf_-_p1_-_its_t_def_ ()_-_enum_id_ () \(\equiv\)_T_Enum_::_T_LR1_parallel_operator_) { _mp_elem_name +="||"; **else** { _mp_elem_name +="|t|"; _fsm_-_MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_, _mp_elem_name_, _mp_obj_type_); _+fsm_elem_no_.; _mp_obj_type_clear_ (); _mp_obj_type += "Circle_dotted"; _mp_elem_name.clear_ (); _mp_elem_name += _sf_-_p2_-_t_in_stdl_ ()_-_t_def_ ()_-_t_name_ ()_-_c_str_ (); _string \(::\)size_typex = mp_elem_name.find_("\\\""); **if** (_x \(\neq\)string \(::\)npos_) { _mp_elem_name.erase_ (); _mp_elem_name += "char(34)"; _}_fsm_-_MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_, _mp_elem_name_, _mp_obj_type_); _+fsm_elem_no_.; _mp_elem_name.clear_ (); _mp_obj_type.clear_ (); _mp_obj_type_ += "Box_dotted"; _mp_elem_name += _sf_-_p3_-_ns_ ()_-_identifier_ ()_-_c_str_ (); _mp_elem_name += "::"; _mp_elem_name += _sf_-_p3_-_called_thread_name_ ()_-_identifier_ ()_-_c_str_ (); _fsm_-_MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_, _mp_elem_name_, _mp_obj_type_); ## 33. _Relement's subrule 5._ (Relement subrule 5 op directive 33) \(\equiv\) _Cmpost_output \(*\) fsm =_ (_Cmpost_output \(*\)_) _rule_info__._parser__-fsm_tbl__; KCHARP_realign_nos =_ "rule_s_subrule_no_elems[%i][%i]:=_%i;"; _sprintf_(fsm-big_buf_, _re_align_nos, fsm-rule_no_, _fsm-subrule_no_, 3); _fsm-omp_file_\(\ll\)_fsm-big_buf_\(\ll\)"%_re-align_cnt" \(\ll\)_end_; _++fsm-elem_no_; _std_::_stringmp_obj_type_("Circle_dotted"); _std_::_stringmp_elem_name_; **if**: (_sf-p1__-its_t_def_()-enum_id_() \(\equiv\)_T_Enum_::_T_LR1_parallel_operator_) { _mp_elem_name_ +="||!"; **else**: { _mp_elem_name_ +="||!"; _fsm-MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_, _mp_elem_name_, _mp_obj_type_); _mp_elem_name_._clear_(); _+fsm-elem_no_; _mp_elem_name_ += _sf-p2__-t_in_std_()-_t_def_()-_t_name_()-_c_str_(); _string_::_size_type_x = _mp_elem_name_find_("\\"); **if**: (_x \(\neq\)_string_::_npos_) { _mp_elem_name_clear_(); _mp_elem_name_ +="char(34)"; } _fsm-MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_, _mp_elem_name_, _mp_obj_type_); _+fsm-elem_no_.; _mp_elem_name_._clear_(); _mp_obj_type_._clear_(); _mp_obj_type_ +="Box_dotted"; _mp_elem_name_ +="NULL"; _fsm-MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_, _mp_elem_name_, _mp_obj_type_); **34.** _Relement's subrule 6._ (Relement subrule 6 op directive 34) \(\equiv\) _Cmpost_output \(*\)fsm \(=\)_ ( _Cmpost_output \(*\)_) _rule_info__parser__~fsm_tbl__; _+fsm_-elem_no_; _std \(::\)stringmp_obj_type_("Circle_solid"); _std \(::\)stringmp_elem_name_(_sf~p1__-_t_in_stbl_(_)~t_def_(_)~t_name_(_)~c_str_(_)); _string \(::\)size_typex = mp_elem_name_find_("\(\backslash\backslash\)"); **if** (\(x\neq\)ring::\(npos\)) { _mp_elem_name_._erase_(); _mp_elem_name \(+\)="char(34)"; } _fsm_-MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_,_mp_elem_name_,_mp_obj_type_); _+fsm_-elem_no_; _mp_obj_type_._clear_(); _mp_obj_type_ \(+\)="Circle_solid"; _mp_elem_name_._clear_(); _mp_elem_name_\(+\)=_sf~p2__-_t_in_stbl_(_)~t_def_(_)~t_name_(_)~c_str_(_); _x = mp_elem_name_._find_("\(\backslash\backslash\)"); **if** (\(x\neq\)string::\(npos\)) { _mp_elem_name_._erase_(); _mp_elem_name_\(+\)="char(34)"; } _fsm_-_MPOST_CWEB_wrt_mp_rhs_elem_(_fsm_,_mp_elem_name_,_mp_obj_type_); **35.** **First Set Language for \(O_{2}^{linker}\).** /* File: mpost_output.fsc Date and Time: Fri Jan 2 15:33:44 2015 */ transitive n grammar-name "mpost_output" name-space "NS_mpost_output" thread-name "Cmpost_output" monolithic y file-name "mpost_output.fsc" no-of-T 569 list-of-native-first-set-terminals 1 T_grammar_phrase end-list-of-native-first-set-terminals list-of-transitive-threads 0 end-list-of-transitive-threads list-of-used-threads 0 end-list-of-used-threads fsm-comments "Output grammar rules railroad diagrams for mpost that cweb program uses." **37. Index.** \(\epsilon\) : 10. |.|: 14, 28. __: 2. __: FILE_: 5. __: LINE_: 5. _add_token_to_error_queue_: 5. _append_: 8. _arbitrator_name_: 8. AST: 6, 7. _ast_: 12. _begin_: 8, 23. _big_buf_: 6, 8, 20, 23, 26, 32, 33. BIG_BUFFER_32K: 6. _c_str_: 5, 8, 23, 26, 29, 30, 32, 33, 34. _CAbs_lr1_sym_: 5. called thread eosubrule: 28. _called_thread_name_: 32. _clear_: 8, 29, 32, 33, 34. _close_: 8. _closure_state_: 8. _Cmpost_output_: 6, 8, 12, 13, 16, 18, 19, 20, 23, 26, 29, 30, 31, 32, 33, 34. _common_la_set_idx_: 8. COMMON_LA_SETS: 7. _COMMON_LA_SETS_type_: 7. _convertMPtoPDF_: 10. _cout_: 26. _cTime_: 5. _cTime_: 5. _cur_state_: 8. _cur_sym_: 8. _cveave_: 2. _cweb_: 2, 23, 26. _cweb_marker_: 12. _cweb_marker_: 23, 26. _def_: 32. _Dimension_: 6. _Dru_how_: 6. _Elem_name_: 6. _elem_name_: 6. _elem_no_: 5, 6, 26, 29, 30, 31, 32, 33, 34. _elem_pos_: 8. _end_: 8, 23. _end_: 8, 20, 23, 26, 32, 33. _entry_symbol_literal_: 8. _enum_id_: 32, 33. eog: 8. eosubrule_: 28. _eosubrule_: 26. _errase_: 32, 34. _Err_bad_filename_: 5. _err_file_: 5. _Err_phrase_: 6. _error-symbols-phrase_: 16. _false_: 26. _fig_no_: 8. _find_: 5, 29, 32, 33, 34. _find_reduced_stateno_: 8. _fu_filename_noext_: 6, 8. _Fs_: 6. _Fsm_: 6. _fsm_: 8, 12, 13, 16, 18, 19, 20, 23, 26, 29, 30, 31, 32, 33, 34. fsm-phrase_: 13. _Fsm_phrase_: 6. _fsm_tbl_: 8, 12, 13, 16, 18, 19, 20, 23, 26, 29, 30, 31, 32, 33, 34. _gened_date_time_: 5, 6. _goto_state_: 8. grammar-phrase_: 9. _grammar_filename_prefix_: 5, 6, 23, 26. _identifier_: 32. _ie_: 23. _ios_: 5. _ios_base_: 5. _iterator_: 23. _its_rule_def_: 8. _its_t_def_: 32, 33. _KCHARP_: 5, 8, 20, 23, 26, 32, 33. _la_set_no_: 8. _la_set_no_template_: 8. _list_: 6. _lrk_file_: 5. _Lrk_phrase_: 6. lr1-k-phrase_: 18. LR1_PARALLEL_OPERATOR: 8. LR1_STATES: 7, 8. _map_: 6. _Max_cweb_item_size_: 8. _mp_dimension_: 5, 6. _mp_elem_name_: 29, 30, 31, 32, 33, 34. _mp_end_: 8. _mp_figure_: 8. _mp_filename_: 5, 6. _mp_init_vars_: 8. _mp_no_of_rules_: 20. _Mp_obj_name_: 6. _mp_obj_type_: 29, 30, 31, 32, 33, 34. _mp_rule_names_: 23. _mp_rules_s_no_rhs_: 23. _mp_rules_s_subrule_no_elems_: 26. _mpost_: 2, 8, 20, 23, 26, 29, 32. _MPOST_CWEB_calc_mp_obj_name_: 6. _MPOST_CWEB_crt_rhs_sym_str_: 6, 8. _MPOST_CWEB_EMIT_PREFIX_CODE_: 5, 6. _MPOST_CWEB_gen_dimension_name_: 6. _MPOST_CWEB_gen_sr_elem_xrefs_: 6, 23. _MPOST_CWEB_LOAD_XLATE_CHRS_: 4, 6. _MPOST_CWEB_should_subrule_be_printed_: 6, 26. _MPOST_CWEB_output_sr_sdcode_: 6, 26. _MPOST_CWEB_wrt_Err_: 6, 16. _MPOST_CWEB_wrt_fsm_: 6, 13. _MPOST_CWEB_wrt_Lrk_: 6, 18. _MPOST_CWEB_wrt_mp_rhs_elem_: 6, 29, 30, _MPOST_CWEB_wrt_rule_slhs_sdc_: 6, 23. _MPOST_CWEB_wrt_T_: 6, 19. _MPOST_CWEB_clated_symbol_: 7, 8. _MPOST_CWEB_ref_ref_red_rule_: 6. _MPOST_CWEB_ref_ref_red_T_: 6. _mpost_output_: 2. _n_: 5. _next_state_element_: 8. _no_elements_: 26. _no_of_elems_: 26. _no_of_rules_: 5, 6, 8, 20. _no_of_subrules_: 5, 6, 23, 26. _no_srs_: 8. _no_subrules_23. _no_subrules_per_rule_: 5, 6, 8, 23. _npos_: 29, 32, 33, 34. _ns_: 32. _NS_vacc02_terminals_: 6, 7. null call thread eosubrule: 28. _nxtsym_1_: 8. _nxtsym_2_: 8. _Ofile_: 7. _ofstream_: 6, 7. _omp_file_: 5, 6, 8, 20, 23, 26, 32, 33. _open_: 5. _out_: 5. _ow_err_file_: 5, 6. _ow_file_: 5, 6, 8, 12, 23, 26. _ow_index_file_: 5, 6. _ow_lrk_file_: 5, 6. _ow_to_file_: 5, 6. _o2extra_: 5. parallel-parser-phrase: 14. _parser_: 5, 8, 12, 13, 16, 18, 19, 20, 23, 26, 29, _30, 31, 32, 33, 34. _pdftex_: 2. _previous_state_: 8. PRT_RULE_S_FIRST_SET: 7. _push_back_: 5, 23. _p1_: 12, 13, 16, 18, 19, 20, 23, 26, 29, 30, _32, 33, 34. _p2_: 32, 33, 34. _p3_: 32. _r_def_: 30. _R_rule_: 6. R_T_: 6. rc-phrase: 17. _rd_: 8. _re_align_nos_: 32, 33. _reduced_state_: 8. refered-rule: 28. refered-T: 28. _refered_rule_: 6. _refered_T_: 6. Relement: 27. _Relement_: 28, 29, 30, 31, 32, 33, 34. _Relements_: 25, 27. Relements_: 25, 27. Rerr_phrase_: 8. _Rerr_phrase_: 16. Rfsm_phrase_: 8. _Rfsm_phrase_: 13. Rgrammar_phrase_: 8. _Rgrammar_phrase_: 9. _rhs_syms_str_: 8. Rk: 11. _Rk_: 12. _Rks_: 11. Rks_: 10, 11. Rks_epi: 8, 21. _Rks_epi_: 10. Rlrl_k_phrase_: 8. _Rlrl_k_phrase_: 18. _Rmpost_output_: 8. _rname_: 23, 26. Rparallel_phrase_: 8. _Rparallel_phrase_: 14. Rrc_phrase_: 8. _Rrc_phrase_: 17. _Rule_: 22. _Rule_def_: 22. _Rule_phrase_: 8. _Rule_def_: 23. _Rule_phrase_: 20. _Rrules_: 8, 21. _Rrules_: 21. Rsubrule_: 24. _Rsubrule_: 25. _Rsubrule_def_: 25. _Rsubrule_def_: 26. _Rsubrules_: 24. _Rsubrules_: 22, 24. _Rt_enum_phrase_: 8. _RT_enum_phrase_: 15. _Rterms_phrase_: 8. _Rterms_phrase_: 19. _rule_def_: 23. _rule_cweb_: 23. _rule_cweb_diagram_: 23. _Rule_def_: 6, 7. _rule_def_: 6, 7. _rule_def_: 6, 7, 8. _rule_def_: 5, 6, 23, 26. _Rule_in_stbl_: 30. _rule_info_: 8, 12, 13, 16, 18, 19, 20, 23, 26, 29, 30, 31, 32, 33, 34. _rule_lhs_: 26. _rule_name_: 8, 23, 26, 30. _rule_name_: 6. _rule_no_: 8. _rule_no_: 5, 6, 23, 26, 32, 33. _rule_s_subrule_no_elems_: 32. rules-phrase: 20. _rules_alphabet_: 20. _rules_for_fs_prt_: 6, 23. _S_VECTOR_ELEMS_ITER_type_: 8. _S_VECTORS_ITER_type_: 8. _se_: 6, 8. _second_: 8. _selie_: 8. _selie_: 8. _set_stop_parse_: 5. _set_who_created_: 5. _sf_: 2, 12, 13, 16, 18, 19, 20, 23, 26, 29, 30, 32, 33, 34. _si_: 8. _sie_: 8. _size_: 20. _size_type_: 29, 32, 33, 34. _sprintf_: 8, 20, 23, 26, 32, 33. _sr_element_: 8. _sr_figure_: 8. _sr_no_: 8. _sr_ph_: 23. _srd_: 8, 23. _srules_: 23. _state_: 8. _state_element_: 6, 8. _state_no_: 8. _state_s_vector_: 8. _state_type_: 8. _state_type_template_: 8. _STATES_ITER_type_: 8. _STATES_type_: 7. _std_: 6, 7, 23, 29, 30, 31, 32, 33, 34. _string_: 5, 6, 8, 29, 30, 31, 32, 33, 34. _subrule_: 32. _subrule_def: 26. _subrule_cweb_: 26. _subrule_cweb_diagram_: 26. _Subrule_def_: 6. _subrule_def_: 5, 6, 8, 26. _subrule_no_: 5, 6, 23, 26, 32, 33. _subrule_no_of_rule_: 8. _subrule_s_tree_: 23. _subrule_sym_: 8. _Subrule_tree_: 6. _subrules_23. _svi_: 8. _syn_: 7. _syn_: 5. _Syn_: 8. _Syn_: 7. _syn_top_state_: 15. _t_def_: 29, 32, 33, 34. _T_Enum_: 32, 33. _T_error_symbols_phrase_: 6. _t_file_: 5. _T_sfm_phrase_: 6. _t_in_stbl_: 29, 32, 33, 34. _T_lr1_k_phrase_: 6. _T_LR1_parallel_operator_: 32, 33. _t_name_: 29, 32, 33, 34. _T_phrase_: 6. _T_subrule_def_: 6, 8, 23. _T_subrules_phrase_: 23. _T_terminals_phrase_: 6. _terminals_phrase_: 19. _theTime_: 5. _three_symbols_string_template_: 8. _time_: 5. _true_: 5. _trunc_: 6, 23. _vectored_into_: 8. _vectored_into_by_elem_: 8. _w_end_: 8. _w_fig_no_: 5, 6, 23, 26. _w_filename_: 5, 6. _w_fsc_file_: 8. _w_index_filename_: 5, 6. _w_lr1_states_: 8. _w_possible_ar_code_: 8. _w_stateno_: 8. _w_stateno_subrule_: 8. WRT_CWEB_MARKER: 12, 23, 26. _XLATE_SYMBOLS_FOR_cweave_: 7, 8. _xlated_names_: 6. _Xlated_str_: 6. _Xlated_sym_: 7. \(\langle\)Cmpost_output constructor directive 4\(\rangle\)\(\langle\)Cmpost_output op directive 5\(\rangle\)\(\langle\)Cmpost_output user-declaration directive 6\(\rangle\)\(\langle\)Cmpost_output user-prefix-declaration directive 7\(\rangle\)\(\langle\)Relement subrule 1 op directive 29\(\rangle\)\(\langle\)Relement subrule 2 op directive 30\(\rangle\langle\)Relement subrule 3 op directive 31\(\rangle\langle\)Relement subrule 4 op directive 32\(\rangle\langle\)Relement subrule 5 op directive 33\(\rangle\langle\)Relement subrule 6 op directive 34\(\rangle\langle\)Reerr_phrase subrule 1 op directive 16\(\rangle\langle\)Rfsm_phrase subrule 1 op directive 13\(\rangle\langle\)Rk subrule 1 op directive 12\(\rangle\langle\)Rlr1_k_phrase subrule 1 op directive 18\(\rangle\langle\)Rmpost_output subrule 1 op directive 8\(\rangle\langle\)Rrule_def subrule 1 op directive 23\(\rangle\langle\)Rrule_phrase subrule 1 op directive 20\(\rangle\langle\)Rsubrule_def subrule 1 op directive 26\(\rangle\langle\)Rterms_phrase subrule 1 op directive 19\(\rangle\langle\) mpost_output Grammar Lr1 State Network
abntex2cite
ctan
"**O pacto abntex2cite**:\n\nEstilos bibliograficos compativeis com a ABNT NBR\n\n6023\n\nLauro Cesa(...TRUNCATED)
ukbill
ctan
"# ukb11:\n\nA package for typesetting UK legislation\n\nElijah Z Granet\n\n13 December 2022\n\nVers(...TRUNCATED)
epspdf
ctan
"# Epspdf and epspdftk User Manual\n\nSiep Kroonenberg (siepo at bitmuis dot nl)\n\n## Table of Cont(...TRUNCATED)
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
0
Edit dataset card