4.2 Simple Customization for Commands Without Arguments

These commands include those whose names are a single nonletter character, such as @@, and those with a normal alphabetic name but whose braces should be empty, such as @TeX{} and @AA{}.

To change the formatting of a command, the functions is texinfo_register_no_arg_command_formatting:

Function: texinfo_register_no_arg_command_formatting ($command_name, $context, $text, $html_element, $translated_string_converted, $translated_string_to_convert)

$command_name is the @-command name, without the leading @. $context is ‘normal’, ‘preformatted’ or ‘string’. There is no separate math context, ‘preformatted’ should be used for math context. See Init File Expansion Contexts: Normal, Preformatted, Code, String, Math. If $context is undef, the ‘normal’ context is assumed.

The remaining arguments determine the formatting. If $text is set, the corresponding text is output when the @-command is formatted. $text can contain HTML elements if needed. If $html_element is set, the text is enclosed between the $html_element element opening and the element closing. If $translated_string_converted is set, the corresponding text is translated when the document language changes and used as text. $translated_string_converted should already be HTML. If $translated_string_to_convert is set, the corresponding text is translated when the document language changes and converted from Texinfo code to HTML. Since the conversion is done in the appropriate context, $translated_string_to_convert should only be set for the ‘normal’ context. See (texi2any_internals)Texinfo::Translations METHODS.

It is not required to set values for all the contexts. If preformatted context output is not set, normal context output is used. If string context output is not set, preformatted context output is used.

For example, if you want ­ to be output for @- in normal, preformatted (and math) and string context, call

texinfo_register_no_arg_command_formatting('-', undef, '­');

If you want <small>...</small> to be output for @enddots in normal context and ... to be output in other contexts, call

texinfo_register_no_arg_command_formatting('enddots',
                                           'normal', '...', 'small');
texinfo_register_no_arg_command_formatting('enddots',
                                           'preformatted', '...');

If you want error--&gt; to be used for @error in every context, with a translation when the document language changes, call

texinfo_register_no_arg_command_formatting('error', undef, undef, undef,
                                           'error--&gt;');

If you want is the same as to be used for @equiv, translated when the document language changes, and converted from Texinfo to HTML in the context of the translation, call

texinfo_register_no_arg_command_formatting('equiv', undef, undef, undef,
                                 undef, 'is the @strong{same} as');

See Translated Strings Customization for customization of translated strings.