# Arabic/Polyglossia/Bidi incompatibility with abnt package

Using bidi redefines chapter headings and also figure counters with chngcntr back to the default book class behavior. I tried to change the order of the packages, even in the .sty file, to no avail.

\documentclass{book}
\usepackage{mwe}
\usepackage{abnt}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[locale=mashriq]{arabic}

\begin{document}
\chapter*{Introduction}

\chapter{Figure tests}
\textarabic{\today}

\begin{figure}
\centering
\includegraphics{example-image-a}
\caption{Caption}
\end{figure}

\begin{figure}
\centering
\includegraphics{example-image-a}
\caption{Caption}
\end{figure}

\end{document}

• You say this is an error, but this code compiles without error for me. I assume there's a problem with the output? Can you explain what that is? – Alan Munn Oct 6 '18 at 11:54
• Adding \counterwithout{figure}{chapter} makes the figure numbering not dependent on chapter which seems to be what abnt does when polyglossia isn't loaded. Is that what you want? – Alan Munn Oct 6 '18 at 12:05
• @AlanMunn, the problem is with bidi, not polyglossia itself. Besides the figure counters (\counterwithout{figure}{chapter} is indeed included in abnt.sty), which are a minor annoyance (new types of floats aren't affected), chapter headings, which had previously been modified by the class, come back to their default book class when using bidi. – Joseph Oct 6 '18 at 17:33
• Yes, of course, but nothing in your question explains any of that. (And it's not an error, just an incompatibility.) You're expecting people to know exactly what abnt does and instantly notice when compiling your example all the things that are different. Given that abnt is itself a very special style, combined with the fact that the vast majority of users of bidi would have no need to use abnt, you're asking an awful lot. bidi indeed changes a lot of things, because it needs to allow RTL in all of the sectioning commands, captions etc. – Alan Munn Oct 6 '18 at 17:39
• @AlanMunn, you're right. I have modified the question to make it clear. – Joseph Oct 6 '18 at 18:06

It's still not totally clear from your question what all changes, but looking into abnt.sty it seems it mainly makes two changes to the formatting of chapters. So I think the following will do what you want.

\documentclass{book}
\usepackage{mwe}
\usepackage{abnt}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[locale=mashriq]{arabic}
\makeatletter
%\vspace*{50\p@}% <----------------- Space from top of page to Chapter #
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \thechapter\ \enspace %\. <-- Chapter #
%\par\nobreak
%\vskip 20\p@% <-------------- Space between Chapter # and title
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak% <------------------ Chapter title
\vskip 40\p@% <------------------ Space between chapter title and first paragraph
}}

%\vspace*{50\p@}%
{\parindent \z@ \centering
\normalfont
\interlinepenalty\@M
\Huge \bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\begin{document}
\chapter*{Introduction}

\chapter{Figure tests}
\textarabic{\today}

\begin{figure}
\centering
\includegraphics{example-image-a}
\caption{Caption}
\end{figure}

\begin{figure}
\centering
\includegraphics{example-image-a}
\caption{Caption}
\end{figure}

\end{document}