1

I'm currently using the following YAML configuration for latexindent:

verbatimEnvironments:
  verbatim: 1
  lstlisting: 1
  minted: 1
  codebox: 1

modifyLineBreaks: textWrapOptions: columns: 80

However, I've encountered an issue where the formatter sometimes wraps text inside my custom command \codeinline{} in an undesirable way. An example of the problem is as follows:

\codeinline{Some really really long text that is going
    to get wrapped}

This behavior is causing issues as it breaks the functionality of my custom command, and subsequently, the project fails to compile.

I'm seeking guidance on how to tweak the configuration to prevent text wrapping within \codeinline{} altogether. Ideally, I'd like to ensure that the text within \codeinline{} remains unaltered until the closing brace, or, if possible, have the entire \codeinline{} command placed on a separate line during formatting.

Any insights or suggestions on adjusting the YAML configuration to achieve this would be greatly appreciated. Thank you!

cmhughes
  • 100,947
  • 1
    verbatimCommands: codeinline: 1 should work I guess. – Marijn Feb 08 '24 at 19:16
  • Yes, @marijn that should work, perhaps an answer? – cmhughes Feb 09 '24 at 12:27
  • @cmhughes if you want to write an answer as the latexindent author then please go ahead :) In order to test it properly I would need to remember how to set everything up, for you that would be much easier I think. – Marijn Feb 09 '24 at 13:38
  • @Marijn Unfortunatly that did not solve my problem. It still wraps text when there is a space in my \codeinline – Oliver Hihn Feb 11 '24 at 14:45
  • @cmhughes Thank you for providing this excellent tool! I discovered that it functions correctly when I utilize an additional { at the end of the text inside my \codeinline to "close" the verbatimCommand. However, I'm uncertain whether this behavior is intentional, as typically in LaTeX, commands use {} for their closure. – Oliver Hihn Feb 11 '24 at 15:19
  • After checking the documentation, it appears this behavior is intentional. I might need to adjust my \codeinline command to use a delimiter similar to verb. Any alternative suggestions? Changing this could affect its use throughout my document, so exploring ways to minimize adjustments. – Oliver Hihn Feb 11 '24 at 15:30

1 Answers1

2

Using

verbatimEnvironments:
  verbatim: 1
  lstlisting: 1
  minted: 1
  codebox: 1

modifyLineBreaks: textWrapOptions: columns: 40

noIndentBlock: codeinline: begin: \codeinline{ end: }

treats codeinline as a verbatim command, and protects it from text wrapping, and all the other operations of latexindent.pl

cmhughes
  • 100,947