I was thinking that adding a \label{...} was not adding any space... But apparently it is wrong sometimes: for instance adding a \label{...} between two environments like proofs adds an unwanted space:
The problem is that I'm using this trick (maybe dirty, but can't find any other solution) in one of my package in order to obtain a reference to the current page/section... Any idea how to get rid of this unwanted space?
\documentclass{article}
\usepackage{amssymb, amsthm, amsmath}
\begin{document}
\section{Without unwanted space}
\begin{proof}
Here is the space without any label after a proof
\end{proof}
% \label{abc} %% <=== uncomment this line to see the space
\begin{proof}
Hello
\end{proof}
\section{With unwanted space}
\begin{proof}
Here is the space with a label after a proof
\end{proof}
\label{abc}
\begin{proof}
Hello
\end{proof}
\end{document}

\nullbetween two proofs adds space.\unskipafter\end{proof}will fix it. – John Kormylo Jun 09 '21 at 14:05\labelwill end up in some essentially arbitrary position with no reference to anything, except the unknown page where it will eventually appear. So why bother? – egreg Jun 09 '21 at 15:33\labelshould go just after or in the section title – egreg Jun 09 '21 at 19:40\sectionso that it updates a macro\currentsectiontitle. Please, make a fresh question with the details, so we can suggest better approaches. The best way to go is stating the real problem and not an attempted solution without clues to the actual problem to solve. – egreg Jun 09 '21 at 20:17\sectionis that the code will depend on the "category" (at least I can't find how to avoid that issue, see the link below for more details). I did create a question a while ago here, see my "EDIT 2021" where I do explain precisely the problem/current poor solution I'm using. https://tex.stackexchange.com/questions/553394/reliably-add-a-label-to-the-current-section-even-if-the-label-is-not-placed-rig – tobiasBora Jun 10 '21 at 11:36