Skip to content

Erroneous Indentation at Paragraph Start and Failure to Wrap First Sentence after \item #521

Open
@aaronpmishkin

Description

@aaronpmishkin

I am trying to combine oneSentencePerLine with text wrapping using when: after, but have encountered two strange issues.

  1. When using when: after, five tabs are inserted before the first sentence following a blank line.

  2. The first sentence after an \item in an itemize or enumerate environment is not wrapped. This is true regardless of the value for when.

original .tex code

This is the first paragraph. We don't expect it to be indented, but we do expect each sentence to be placed on its own line and for long sentences to be wrapped at 79 characters. Hopefully it works properly.

This is the second paragraph. We don't expect it to be indented either, but for some reason five tabs are inserted at the very start of the paragraph. This unexpected behavior disappears if text wrapping is performed before code blocks are identified, but then indented blocks will not be properly wrapped at 79 characters.
Hopefully we can fix this by doing the following.
\begin{itemize}
    \item Oddly, while sentences are placed on new lines, the first sentence after the ``item'' command is not wrapped even if it is longer than 79 characters. The second sentence is properly wrapped, so many this has something to do with sentence identification after ``item'' commands. 
\end{itemize}

yaml settings

defaultIndent: '    '
preserveBlankLines: 1
condenseMultipleBlankLinesInto: 0
maxNumberOfBackUps: 9
modifyLineBreaks:
  environments:
    BeginStartsOnOwnLine: 1
    BodyStartsOnOwnLine: 1
    EndStartsOnOwnLine: 1
    EndFinishesWithLineBreak: 1
  oneSentencePerLine:
    manipulateSentences: 1
    removeSentenceLineBreaks: 1
    textWrapSentences: 1 
    sentencesFollow:
      par: 1
      blankLine: 1
      fullStop: 1
      exclamationMark: 1
      questionMark: 1
      rightBrace: 1
      commentOnPreviousLine: 1
    sentencesBeginWith:
      A-Z: 1
    sentencesEndWith:
      basicFullStop: 0
      betterFullStop: 1
      exclamationMark: 1
      questionMark: 1
  textWrapOptions:
    columns: 79
    when: after
    blocksFollow:
               other: |-
                 (?x)
                    \\\]
                    |
                    \\item(?:\h|\[)
                    |
                    \\caption\h*(?:\[\])?\h*\{ 

actual/given output

This is the first paragraph.
We don't expect it to be indented, but we do expect each sentence to be placed
on its own line and for long sentences to be wrapped at 79 characters.
Hopefully it works properly.

                   This is the second paragraph.
We don't expect it to be indented either, but for some reason five tabs are
inserted at the very start of the paragraph.
This unexpected behavior disappears if text wrapping is performed before code
blocks are identified, but then indented blocks will not be properly wrapped
at 79 characters.
Hopefully we can fix this by doing the following.
\begin{itemize}
    \item Oddly, while sentences are placed on new lines, the first sentence after the ``item'' command is not wrapped even if it is longer than 79 characters.
          The second sentence is properly wrapped, so many this has something
          to do with sentence identification after ``item'' commands.
\end{itemize}

desired or expected output

This is the first paragraph.
We don't expect it to be indented, but we do expect each sentence to be placed
on its own line and for long sentences to be wrapped at 79 characters.
Hopefully it works properly.

This is the second paragraph.
We don't expect it to be indented either, but for some reason five tabs are
inserted at the very start of the paragraph.
This unexpected behavior disappears if text wrapping is performed before code
blocks are identified, but then indented blocks will not be properly wrapped
at 79 characters.
Hopefully we can fix this.
\begin{itemize}
    \item Oddly, while sentences are placed on new lines , the first sentence
          after the ``item'' command is not wrapped even if it is longer than
          79 characters.
          The second sentence is properly wrapped, so maybe this has something
          to do with sentence identification after ``item'' commands.
\end{itemize}

anything else

Perhaps the first problem is an issue with my configuration. However, the default value

textWrapOptions:
  blocksFollow:
    other: \\\]|\\item(?:\h|\[)

makes me think that sentences after \item should automatically be identified as blocks to be wrapped. Is this correct?

As for the second problem, I expected the indentation to be the same regardless of the timing of text wrapping. My understanding is that when: after should change text wrapping to occur after indentation is handled, but leave indentation the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected behaviour; should be a priority for fixingone-sentence-per-lineone sentence per line; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switchtext-wraptext wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.htmltext-wrap-after

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions