arXiv / arXiv/html_feedback

lstlisting environment does not preservere leading whitespace

Open
#2,201 3 comments 1 reaction 0 assignees View on GitHub
bug listings styles
Dominant language
No language data
Stars
42
Forks
40
PR merge metrics
No merged PRs in 30d

Description

### Description

When using the `lstlisting` environment from the `listings` package, indentation is not preserved. See Fig. 1. The TeX source is:
```latex
\begin{figure}[t]
\begin{lstlisting}[
basicstyle=\ttfamily\scriptsize,
emph={[2]send_buf, send_counts, recv_counts_out, recv_displs_out},
emphstyle={[2]\color{gray}},
commentstyle=\textcolor{my-dark-red},
emph={[3]vector, std, exclusive_scan, move},
emphstyle={[3]\color{my-purple}},
escapechar=!
]
std::vector v = {...};
// KaMPIng allows concise code
// with sensible defaults ... (1)
auto v_global = comm.allgatherv(send_buf(v));

// ... or detailed tuning of each parameter (2)
std::vector rc;
auto [v_global, rcounts, rdispls] = comm.allgatherv(
send_buf(v), //(3)
recv_counts_out(std::move(rc)), //(4)
recv_displs_out() //(5)
);
\end{lstlisting}
\caption{\kamping offers a high-level easy-to-use interface (1) and full control over each parameter (2). Data types and buffer sizes can be automatically inferred (3). Arguments allow passing by reference or by value and transferring data ownership via move semantics (4). Out-parameters allow controlling which default-computed parameters are returned to the user (5). Resize policies allow controlling memory allocation (6).}
\label{fig:kamping-intro}
\end{figure}
```

### (Optional:) Please add any files, screenshots, or other information here.

![Screenshot from 2024-09-27 13-32-39](https://github.com/user-attachments/assets/e7cc3063-6468-4cf4-b637-84aed958776c)

### (Required) What is this issue most closely related to? Select one.

Figures

### Internal issue ID

4912f6dc-7853-475f-aa5d-89a87ab4de15

### Paper URL

https://arxiv.org/html/2404.05610v3

### Browser

Chrome/128.0.0.0

### Device Type

Desktop

Contributor guide

Open the contributing guide

Research direction

Reproduce the rendering using the supplied LaTeX source with the listings package and the lstlisting environment, then compare it with the HTML version of the linked paper. Trace how leading whitespace in the listing is represented in the rendered figure. Done means indentation matches the source while the listing remains correctly formatted.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.