mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

FEATURE: Editing macros with arguments

Open corlick98 opened this issue 3 years ago • 2 comments

Description

If I have a macro with args (Plus: {args: 2, def: '#1+#2', expand: false}) and I add it to a key of a custom keyboard with placeholders for the args ({latex: '+', insert: '\\Plus{\\placeholder{}}{\\placeholder{}}'}) then if I get the value of the math-field the placeholders are not substituted for the values that the user filled in unless I add expand: true to the macro definition and use mf.getValue('latex-expanded') instead of latex or math-ml. Is this the intended behavior?

With expand: false: WithoutExpand

With expand: true: WithExpand

JSFiddle: https://jsfiddle.net/1rx3huz6/4/ Relevant line is 129.

Actual Behavior

Placeholders are not substituted unless macro is defined with expand: true and one uses .getValue('latex-expanded')

Expected Behavior

Placeholders are substituted in at least some of the other scenarios.

Environment

MathLive version mathlive: 0.77.0

Operating System [macOS, Windows, iOS. Include the version] Ubuntu 20.04.4 LTS

Browser [Safari, Chrome, IE, Firefox, etc... Try several browsers and note if there are differences between browsers. Include the version number of the browsers.] Firefox 103.0 (64-bit)

Also tested in jsfiddle on Chrome 103.0.5060.134 (Official Build) (64-bit).

corlick98 avatar Aug 05 '22 03:08 corlick98

I had a look at this. This is going to require a non-trivial amount of changes, but I'm going to give it a try. This may take a little while.

arnog avatar Aug 08 '22 15:08 arnog

Thank you for looking into it.

corlick98 avatar Aug 08 '22 20:08 corlick98