TransWikia.com

Cross referencing sections one number off

TeX - LaTeX Asked by Abraham Belderbos on August 1, 2021

I’m having trouble with cross referencing to (sub)sections. Each time I refer to a certain subsection in my text (e.g. Article 2. Second title), the compiled pdf doesn’t refer to ‘2’ but to ‘1’. In short it’s always one off.

subsection{First title}label{subsec:first}
Some text

subsection{Second title}label{subsec:second}
Some other text

subsection{Third title}label{subsec:third}
Some reference to ref(subsec:second)

When compiling this code I would expect a reference to 2 but instead this is what comes out:

enter image description here

I’ve changed the layout of the (sub)section titles with this code and my guess is that it goes wrong in these commands:

newcounter{mysubsection}
defthesubsection{arabic{mysubsection}}
deflabelsubsection{Article}
titleformat{subsection}
            [hang]
            {normalfontlargebfseries}
            {addtocounter{mysubsection}{1}labelsubsection~thesubsection.}
            {10pt}
            {}

Could somebody explain what goes wrong?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP