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{}.

You can set directly the formatting of those commands in different contexts with texinfo_register_no_arg_command_formatting:

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

$command_name is the @-command name, without the leading @. $context is ‘normal’, ‘preformatted’ or ‘string’. There is no separate math nor code context, ‘preformatted’ should be used for math and code contexts. 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.

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.

Function: texinfo_register_no_arg_command_formatting ($command_name, $translated_string_to_convert)

$command_name is the @-command name, without the leading @. $translated_string_to_convert is the Texinfo code used for the command formatting. This Texinfo code is translated when the document language changes and converted from Texinfo to HTML in the different expansion contexts, ‘normal’, ‘preformatted’ and ‘string’. See (texi2any_internals)Texinfo::Translations METHODS.

If both Texinfo code and explicit formatting are specified, the explicit formatting takes precedence.

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 different expansion contexts, call

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

See Translated Strings Customization for customization of translated strings.