Skip to content

Commit

Permalink
Handle \left and \right commands
Browse files Browse the repository at this point in the history
`\left` and `\right` commands used with `listings`-`fancyverb`
interface, even when properly registered with `morefvcmdparams` lead to
"Missing delimiter" error.

Probably they use their argument in some special way incompatible with
how `listings` is passing arguments to `fvcmdparams`-registered
commands.

We can make them work by wrapping them with "ordinary" document level
commands. Since those commands should work as originals, we just
redefine originals locally inside formatted cells that use `listings`.
  • Loading branch information
jkuczm committed May 13, 2021
1 parent 5ddaa70 commit 7af8e49
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mmacells.sty
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,18 @@
\clist_put_left:NV
\l_mmacells_lst_keyval_clist
\l_mmacells_formatted_lst_keyval_clist

% \left and \right commands don't work properly with listings-fancyverb
% interface, we can make them work by redefining them as "ordinary"
% document-level functions.
\RenewDocumentCommand \left { m } { \__mmacells_tex_left:w ##1 }
\RenewDocumentCommand \right { m } { \__mmacells_tex_right:w ##1 }
}
}

\cs_new_eq:NN \__mmacells_tex_left:w \left
\cs_new_eq:NN \__mmacells_tex_right:w \right

\cs_new_protected_nopar:Npn \__mmacells_prepare_lst_keyval:
{
\clist_put_left:Nn \l_mmacells_lst_keyval_clist { fancyvrb=true }
Expand Down Expand Up @@ -714,6 +723,8 @@
morefvcmdparams=\Big 1,
morefvcmdparams=\bigg 1,
morefvcmdparams=\Bigg 1,
morefvcmdparams=\left 1,
morefvcmdparams=\right 1,
}


Expand Down

0 comments on commit 7af8e49

Please sign in to comment.