Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra spaces added when aligning tables with URLs that contain ampersands #3336

Closed
JAK0723 opened this issue Dec 2, 2023 · 1 comment · Fixed by #3374
Closed

Extra spaces added when aligning tables with URLs that contain ampersands #3336

JAK0723 opened this issue Dec 2, 2023 · 1 comment · Fixed by #3374
Assignees
Labels
bug Deficiencies in TeXiFy behaviour.

Comments

@JAK0723
Copy link

JAK0723 commented Dec 2, 2023

Type of JetBrains IDE (IntelliJ, PyCharm, etc.) and version

PyCharm 2023.2.5 (build PY-232.10227.11)

Operating System

Windows 11 (23H2)

TeXiFy IDEA version

0.9.2

What I did (steps to reproduce)

When I reformat a LaTeX file where a table with URLs that contain ampersands, then spaces get added to the sides of the ampersands. This effect occurs for every subsequent reformatting, which can lead to a lot of extra spaces.

Minimal example to reproduce the problem

\documentclass{article}
\usepackage{hyperref}
\begin{document}
    \begin{tabular}{ll}
        a & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB&t=18} \\
        b & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB&t=18}
    \end{tabular}
\end{document}

Expected behavior

The table should be aligned correctly, in the above case, nothing should change:

\begin{tabular}{ll}
    a & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB&t=18} \\
    b & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB&t=18}
\end{tabular}

Actual behavior

Spaces are added to the sides of the ampersands:

\begin{tabular}{ll}
    a & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB & t=18} \\
    b & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB & t=18}
\end{tabular}

Oddly, if the ampersands are escaped, then spaces are only added to the right:

\begin{tabular}{ll}
    a & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB\& t=18} \\
    b & \url{https://youtu.be/dQw4w9WgXcQ?si=SHq6ADlwRNZ1hwOB\& t=18}
\end{tabular}
@JAK0723 JAK0723 added bug Deficiencies in TeXiFy behaviour. untriaged Issue type still needs to be triaged or verified. labels Dec 2, 2023
@PHPirates PHPirates removed the untriaged Issue type still needs to be triaged or verified. label Dec 4, 2023
@PHPirates
Copy link
Collaborator

Thanks a lot for reporting this! I have indeed missed this edge case in the formatting tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Deficiencies in TeXiFy behaviour.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants