Two attempts which not worked
Herein there are 2 examples which did not work. Each attempt has written over it % Not works:
\PassOptionsToPackage{brazil,main=english}{babel}
\documentclass[10pt,a5paper,twoside]{abntex2}
\pdfstringdefDisableCommands{\let\uppercase\relax}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
style=abnt,
language=english,
backref=true,
backend=biber,
citecounter=true
]{biblatex}
\addbibresource{references.bib}
\usepackage{csquotes}
\makeatletter
\let\orig@listi\@listi
\def\@listi{\orig@listi\topsep=0pt} % Not works
\makeatother
\begin{document}
Test
\begin{citacao}\setlength{\topsep}{0pt} % Not works
Test
\end{citacao}
Test
\end{document}
The citacao environment is implemented at:
-
\newenvironment*{citacao}[1][default]{% \list{}% \ABNTEXfontereduzida% \addtolength{\leftskip}{\ABNTEXcitacaorecuo}% \item[]% \begin{SingleSpace}% \ifthenelse{\not\equal{#1}{default}}{\itshape\selectlanguage{#1}}{}% }{% \end{SingleSpace}% \endlist}% % ---
Two attempts which worked
Herein there are 2 examples which did worked.The first is by renewing the environment, the other opening the abntex2 files on my computer and changing the implementation.
I could just change its implementation adding
{\topsep=0pt}as in:\newenvironment*{citacao}[1][default]{% \list{}{\topsep=0pt}% \ABNTEXfontereduzida% \addtolength{\leftskip}{\ABNTEXcitacaorecuo}% \item[]% \begin{SingleSpace}% \ifthenelse{\not\equal{#1}{default}}{\itshape\selectlanguage{#1}}{}% }{% \end{SingleSpace}% \endlist}%Or renew the environment in my document as in:
\renewenvironment*{citacao}[1][default]{% \list{}{\topsep=0pt}% \ABNTEXfontereduzida% \addtolength{\leftskip}{\ABNTEXcitacaorecuo}% \item[]% \begin{SingleSpace}% \ifthenelse{\not\equal{#1}{default}}{\itshape\selectlanguage{#1}}{}% }{% \end{SingleSpace}% \endlist}%
The question
But I would like to not hardly copy their implementation, neither am interested in doing a pull request for adding {\topsep=0pt}. May I do something like this bellow, patching the environment?
\pretocmd{\citacao}{\let\oldtopsep\topsep \setlength{\topsep}{0pt}}{}{}
\xapptocmd{\citacaoend}{\let\topsep\oldtopsep}{}{}
Why this is not on my code on the beginning of the post?
Because I could not make it work patching it manually, by adding \setlength{\topsep}{0pt}, therefore loading xpatch will do no help if I do not know how to patch. None of these worked:
% First attempt
\makeatletter
\let\orig@listi\@listi
\def\@listi{\orig@listi\topsep=0pt} % Not works
\makeatother
...
% Second attempt
\begin{citacao}\setlength{\topsep}{0pt} % Not works
Test
\end{citacao}
Related questions:

% Not works. I will update the post with this information. – user Sep 17 '17 at 01:13\patchcmdand search for\list{}and replace with the line you want there instead. – cfr Sep 17 '17 at 03:03\topsep=0ptis not applied, i.e., it is ignored. I also just tried to do\xpatchcmd{\citacao}{\list{}}{\list{}{\topsep=0pt}}{}{}and it worked, but if some day they decide to add some argument to the\citation\list{}{}, it would stop working. That is why I thought about trying to use\xapptocmdand\pretocmd. – user Sep 17 '17 at 04:42\list{}and before\item. Use the final arguments to trigger an error or warning in case an update stops it working. – cfr Sep 17 '17 at 04:49\list\topsep=0ptis on the list declaration itself? – user Sep 17 '17 at 04:52