Skip to content

Wrong syntax highlighting for lstinline if options in brackets are used #1956

@Toromtomtom

Description

@Toromtomtom

When setting options for \lstinline with brackets, the syntax highlighting assumes that the opening bracket [ is the delimiter for the listing code. In the following example file, the syntax highlighting is correct for the first usage of \lstinline. The second usage, however, sets the language for the listing with brackets, and all characters until the next [ are highlighted as if they were part of the listing.

\documentclass{article}
\usepackage{listings}
\begin{document}

The declaration \lstinline|int x;| creates a new variable.

The declaration \lstinline[language=C]|int x;| creates a new variable.

\end{document}

(The Markdown highlighting here seems to have the same problem).

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