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

\vspace warning with \lstinputlisting #522

Open
jasigal opened this issue Feb 12, 2024 · 8 comments
Open

\vspace warning with \lstinputlisting #522

jasigal opened this issue Feb 12, 2024 · 8 comments

Comments

@jasigal
Copy link

jasigal commented Feb 12, 2024

The following minimal example LaTeX file

\documentclass{acmart}
\usepackage{listings}

\begin{document}
\lstinputlisting{test.ml}
\end{document}

where test.ml is

type test = Test

produces the warning

Class acmart Warning: \vspace should only be used to provide space above/below
surrounding objects on input line 5.

twice.

Seems that others have experienced this as well.

I am using a newly downloaded version of TeX Live which includes acmart v2.03.

@Ashen1110
Copy link

Same issue 😭

@laowantong
Copy link

Same issue with:

\begin{lstlisting}
    ...
\end{lstlisting}

@stephennspencer
Copy link
Contributor

Yes... and that's fine.

Authors are given clear direction: they are not to use \vspace to override the article template in their content - reducing the amount of whitespace around tables and figures, for example - with the exception of the "wrapfigure" and "wraptable" environments, which depend upon that command to successfully work.

@kenohassler
Copy link

So, what are authors supposed to do in this case? The listings package is allowlisted by ACM, so I would think authors can safely ignore this warning, making it pointless.

@laowantong
Copy link

Thanks, I had the same question: assuming this is fine, is there any workaround to avoid polluting the output with a warning for each listing?

@stephennspencer
Copy link
Contributor

I doubt there’s a way to suppress those warnings when they’re thrown by packages one is including. Just ignore them.

@smokhov
Copy link
Contributor

smokhov commented Jan 11, 2025

Apparently @borisveytsman managed to do it before in #367, specifically e.g. in 8058e1e#diff-12977da1544b9179cf70fa8b566084851fa22288887c4b240e8153e3949b6071R3323 or similar, so I guess learning what environment lstinputlisting is using and add it to the existing exceptions list for all of us with the OCD for warnings...

@smokhov
Copy link
Contributor

smokhov commented Jan 11, 2025

Actually it is already there:

acmart/acmart.dtx

Line 4080 in 552f66b

\AtBeginEnvironment{lstinputlisting}{\let\@vspace\@vspace@orig

Hmm...

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

No branches or pull requests

6 participants