Skip to content

Environment template: Unwanted newline at the beginning if there is only whitespace on the current line #58

Description

@Sinthoras7

Currently, the environment templates, e.g. equ then tab, insert the environment on the current line, if the cursor is at the beginning of the line; and first create a new line and then insert the environment if the cursor is at a line, where things have been typed before, i.e. the cursor is not at the beginning of the line.

This behavior is mostly great, because the begin{equation} should have its own line and not be at the end of some line. A problem arises, when there is only whitespace on the current line before the cursor. In this case, the begin{equation} should be inserted in the same line, since the line is empty modulo whitespace.
But instead - I assume because the cursor is not at the beginning of the line, since there is whitespace before it - a new line gets inserted, creating a completely empty line between the text before and the begin{equation}.

This empty line is a problem, because Latex then interprets this as a new paragraph and inserts extra space between the text and the environment, e.g. the equation. (Also for aesthetic- and clarity-reasons in the .tex file, but those are secondary.)
This problem gets enhanced, because Auctex creates these whitespaces automatically, when creating a new line in the .tex file inside an environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions