Closed Enivex closed 7 months ago
Thanks for this.
Using
modifyLineBreaks:
commands:
label:
CommandStartsOnOwnLine: 1
then we receive your desired output
\begin{theorem}[something]
\label{something}
Theorem text
\end{theorem
Thanks for this.
Using
modifyLineBreaks: commands: label: CommandStartsOnOwnLine: 1
then we receive your desired output
\begin{theorem}[something] \label{something} Theorem text \end{theorem
Thanks for the workaround
Regarding the closure of the issue, isn't this still a bug though?
This isn't a bug. If you want a command to start on its own line the command poly switch is the one to use.
If you want an optional argument to finish with a line break, then the optional argument poly switch is the one to use.
On Wed, 17 Jan 2024, 19:34 Enivex, @.***> wrote:
Regarding the closure of the issue, isn't this still a bug though?
— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/508#issuecomment-1896521599, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYBWSXS6X4B757TS7WTYPARTRAVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGUZDCNJZHE . You are receiving this because you modified the open/close state.Message ID: @.***>
This isn't a bug. If you want a command to start on its own line the command poly switch is the one to use. If you want an optional argument to finish with a line break, then the optional argument poly switch is the one to use. … On Wed, 17 Jan 2024, 19:34 Enivex, @.> wrote: Regarding the closure of the issue, isn't this still a bug though? — Reply to this email directly, view it on GitHub <#508 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYBWSXS6X4B757TS7WTYPARTRAVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGUZDCNJZHE . You are receiving this because you modified the open/close state.Message ID: @.>
The point is that modifyLineBreaks:environments:BodyStartsOnOwnLine:1
should make anything inside an environment start on the next line. This works as it should if there is no optional argument, i.e.
\begin{theorem} \label{something}
Theorem text
\end{theorem
will be formatted as
\begin{theorem}
\label{something}
Theorem text
\end{theorem
even without modifyLineBreaks:commands:label: CommandStartsOnOwnLine: 1
.
Unless I'm missing something I don't understand why the presence of the optional argument to theorem
should matter.
Have a look at the table at
https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html#id69
It explains, visually, where each of the poly switches correspond.
On Wed, 17 Jan 2024, 20:44 Enivex, @.***> wrote:
This isn't a bug. If you want a command to start on its own line the command poly switch is the one to use. If you want an optional argument to finish with a line break, then the optional argument poly switch is the one to use. … <#m1470717740729905827> On Wed, 17 Jan 2024, 19:34 Enivex, @.> wrote: Regarding the closure of the issue, isn't this still a bug though? — Reply to this email directly, view it on GitHub <#508 (comment) https://github.com/cmhughes/latexindent.pl/issues/508#issuecomment-1896521599>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYBWSXS6X4B757TS7WTYPARTRAVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGUZDCNJZHE https://github.com/notifications/unsubscribe-auth/AAQ7CYBWSXS6X4B757TS7WTYPARTRAVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGUZDCNJZHE . You are receiving this because you modified the open/close state.Message ID: @.>
The point is that modifyLineBreaks:environments:BodyStartsOnOwnLine:1 should make anything inside an environment start on the next line. This works as it should if there is no optional argument, i.e.
\begin{theorem} \label{something} Theorem text \end{theorem
will be formatted as
\begin{theorem} \label{something} Theorem text \end{theorem
even without modifyLineBreaks:commands:label: CommandStartsOnOwnLine: 1.
Unless I'm missing something I don't understand why the presence of the optional argument to theorem should matter.
— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/508#issuecomment-1896659332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYEDFN2B5FR4R7YRO2TYPAZ35AVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGY2TSMZTGI . You are receiving this because you modified the open/close state.Message ID: @.***>
Have a look at the table at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html#id69 It explains, visually, where each of the poly switches correspond. … On Wed, 17 Jan 2024, 20:44 Enivex, @.> wrote: This isn't a bug. If you want a command to start on its own line the command poly switch is the one to use. If you want an optional argument to finish with a line break, then the optional argument poly switch is the one to use. … <#m1470717740729905827> On Wed, 17 Jan 2024, 19:34 Enivex, @.> wrote: Regarding the closure of the issue, isn't this still a bug though? — Reply to this email directly, view it on GitHub <#508 (comment) <#508 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYBWSXS6X4B757TS7WTYPARTRAVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGUZDCNJZHE https://github.com/notifications/unsubscribe-auth/AAQ7CYBWSXS6X4B757TS7WTYPARTRAVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGUZDCNJZHE . You are receiving this because you modified the open/close state.Message ID: @.> The point is that modifyLineBreaks:environments:BodyStartsOnOwnLine:1 should make anything inside an environment start on the next line. This works as it should if there is no optional argument, i.e. \begin{theorem} \label{something} Theorem text \end{theorem will be formatted as \begin{theorem} \label{something} Theorem text \end{theorem even without modifyLineBreaks:commands:label: CommandStartsOnOwnLine: 1. Unless I'm missing something I don't understand why the presence of the optional argument to theorem should matter. — Reply to this email directly, view it on GitHub <#508 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYEDFN2B5FR4R7YRO2TYPAZ35AVCNFSM6AAAAABB6UP5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGY2TSMZTGI . You are receiving this because you modified the open/close state.Message ID: @.>
I'm sorry if I'm dense, but I really can't figure out how to get a linebreak after optional (or mandatory) arguments to an environment without also this applying to commands all over the place.
No worries :)
Here's a couple of options
modifyLineBreaks:
optionalArguments:
theorem:
RSqBFinishesWithLineBreak: 1 # -1,0,1,2,3,4
modifyLineBreaks:
optionalArguments:
RSqBFinishesWithLineBreak: 1 # -1,0,1,2,3,4
both give
\begin{theorem}[something]
\label{something}
Theorem text
\end{theorem}
Thanks, Option 1 will work, but is there a way to do it where I don't have to manually add an entry for every single environment? I just want it to apply to any \begin{environment}[optional argument]
? Option 2 I have tried before, but it applies to literally any optional arguments to anything (even brackets in math)
replacements:
-
substitution: |-
s/(\\begin\{[^}]+?\}\h*\[[^]]+?\])\h*(\\[a-zA-Z])/$1\n$2/sg
called using latexindent.pl -r -l myfile.tex
specialBeginEnd:
specialBeforeCommand: 1
myenv:
begin: \\begin\{[^}]+?\}\h*\[[^]]+?\]
end: \\end\{[^}]+?\}
modifyLineBreaks:
specialBeginEnd:
myenv:
SpecialBodyStartsOnOwnLine: 1
fineTuning:
environments:
name: [1]+
Please provide the following when posting an issue:
original .tex code
yaml settings
actual/given output
desired or expected output
Please paste your desired/expected output here; that is, what do you want the output to look like
anything else
Please put any comments or anything else here :)