Skip to content

\hbox refactoring #2050

@edemaine

Description

@edemaine

Context from #1787:

  1. \raisebox and now \fbox want their argument formatted with \hbox, and now do so using hbox argument type.

  2. As mentioned, \verb has code to \hboxify its argument, which could be simplified with the new hbox argument type (though is admittedly pretty simple):

            // \verb enters text mode and therefore is sized like \textstyle
            const newOptions = options.havingStyle(options.style.text());

As mentioned here, it would be nice to define everything using a new function \hbox that does the hbox argument type reformatting, but with the current setup, it's messy/ugly currently because macros and functions are annoying to mix. We'd have to define \fbox and \raisebox as macros that call a function \hbox to do the reformatting and an auxiliary function like \@fbox and \@raisebox that do the actual rendering, as in \def\fbox#1{\@fbox{hbox{#1}}}.

Instead, I propose defining a new defineFunction mechanism for preprocessing arguments according to macros, like argMap: ["\hbox{#1}"] meaning "for my first argument, please give me \hbox{#1} instead of #1". This would be a lot more general than the current hbox arg type, and would keep function definitions very convenient, without having to define macros and intermediate functions like \@fbox, and separating out the functionality of hbox-style "argument reformattings" from other argument types' "argument parsing". This would then offer a drop-in replacement for hbox argument type.

As a plus, we'd also then support \hbox (and maybe \mbox).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions