cmhughes / latexindent.pl

Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
GNU General Public License v3.0
884 stars 84 forks source link

oneSentencePerLine cuts `I.e.\` #321

Closed tdegeus closed 2 years ago

tdegeus commented 2 years ago

Please provide the following when posting an issue:

original .tex code

\documentclass{article}

\begin{document}

I.e.\ it is a finite constant.

\end{document}

yaml settings

onlyOneBackUp: 1
defaultIndent: "    "
removeTrailingWhitespace: 1
modifyLineBreaks:
  textWrapOptions:
    columns: 100
  oneSentencePerLine:
    manipulateSentences: 1
    removeSentenceLineBreaks: 0

command:

latexindent.pl -l -m -s -w main.tex

actual/given output

\documentclass{article}

\begin{document}

I.e.
\ it is a finite constant.

\end{document}

desired or expected output

\documentclass{article}

\begin{document}

I.e.\ it is a finite constant.

\end{document}
cmhughes commented 2 years ago

Thanks for this, perhaps you can tweak the fine tuning as in https://github.com/cmhughes/latexindent.pl/issues/200

How about the following?

modifyLineBreaks:
    oneSentencePerLine:
        manipulateSentences: 1

fineTuning:
    modifyLineBreaks:
      betterFullStop: '(?:\.\)(?!\h*[a-z]))|(?:(?<!(?:(?:e\.g)|(?:i\.e)|(?:I\.e)|(?:etc))))\.(?!(?:\h*[a-z]|[A-Z]|\-|~|\,|[0-9]|\}))'
tdegeus commented 2 years ago

Thanks! Should this be considered for the default behaviour?

cmhughes commented 2 years ago

I don't mind :) feel free to submit a pull request if you feel strongly enough :)

On Tue, 4 Jan 2022, 08:25 Tom de Geus, @.***> wrote:

Reopened #321 https://github.com/cmhughes/latexindent.pl/issues/321.

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/321#event-5838929976, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYBCB4BDAXBW3FPRBN3UUKVIPANCNFSM5LFJ27CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

tdegeus commented 2 years ago

Will do. Let's keep this open for a bit then

cmhughes commented 2 years ago

This is implemented as of https://github.com/cmhughes/latexindent.pl/commit/38b789b1a8df32f80c96205e7c038c4023cd3065 and will be part of the next release, hopefully coming soon.

I'll leave this open until released.

cmhughes commented 2 years ago

resolved as of https://github.com/cmhughes/latexindent.pl/releases/tag/V3.14 upload to ctan imminent.

tdegeus commented 2 years ago

Thanks !