Graphics, Figures & TablesMy float items are linked to wrong entities

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
arastpour
Posts: 4
Joined: Thu Aug 09, 2012 8:48 pm

My float items are linked to wrong entities

Post by arastpour »

I am using a .sty file from my university to prepare my dissertation. In this file, there is a "float" for "Algorithms" that I use to define Algorithm 1, Algorithm 2, and so on. My problem is that, no matter what the labels of my algorithms in the Appendix section are, when I call them, their reference number is linked to algorithms in the main body, as opposed to the algorithms that they belong to.

After doing some research, I realized that there are parts of the .sty file that govern how the "list of Algorithms" are organized. This file creates a file with extension .lom that keeps all information about the algorithm list. In this file, the labels of appendix algorithms are linked to algorithms in the body! Please find below parts of the .sty file that talk about "list of Algorithms" rules. I am wondering if someone can help me with debugging these lines.

Code: Select all

\def\listofalgorithms{%
\newpage
\addcontentsline{toc}{chapter}{LIST OF ALGORITHMS}
\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
\hbox{ }
\twoinmar
\centerline{\large\bf LIST OF ALGORITHMS}
\vspace{0.7in}
\begin{doublespace}
\@starttoc{lom}\if@restonecol\twocolumn\fi
\addtocontents{lom}{\noindent\underline{\bf Algorithm}\hfill\rm\protect\newline}
\end{doublespace}
\pagestyle {empty}
}

\newcounter{algorithm}[chapter]
\def\thealgorithm{\@arabic\c@chapter.\@arabic\c@algorithm}
\def\fps@algorithm{tbp}
\def\ftype@algorithm{1}
\def\ext@algorithm{lom}
\def\fnum@algorithm{Algorithm\thealgorithm}
\def\algorithm{\@float{algorithm}}
\let\endalgorithm\end@float
\@namedef{algorithm*}{\@dblfloat{algorithm}}
\@namedef{endalgorithm*}{\end@dblfloat}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

arastpour
Posts: 4
Joined: Thu Aug 09, 2012 8:48 pm

Re: My float items are linked to wrong entities

Post by arastpour »

This problem is solved. If someone else has a similar issue, s/he can find the solution here: http://tex.stackexchange.com/questions/ ... g-entities
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: My float items are linked to wrong entities

Post by Johannes_B »

Can you please summarize the steps that resolved the issue?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply