-
Which version of the template are you using? Do you use a cloud-based service? Which one? Do you use a local service? I am using latexmk with the pdflatex backend What went wrong? \newcommand{\listchangesname}{List of Changes}
\newlistof{changelog}{loc}{\listchangesname}
\newcommand{\change}[1]
{%
\refstepcounter{changelog}%
\par\noindent\textbf{Change \thechangelog. #1}
\addcontentsline{loc}{changelog}{\protect\numberline{\thechapter.\thechangelog} \hspace{0.3em} #1}\par
} As a result, the custom macro The text I have this code in the \netaddlistof{listofchangelog} ( What was expected? \documentclass[16pt]{book}
\usepackage{tocloft}
\usepackage{lipsum}
\newcommand{\listchangesname}{List of Changes}
\newlistof{changelog}{loc}{\listchangesname}
\newcommand{\change}[1]
{%
\refstepcounter{changelog}%
\par\noindent\textbf{Change \thechangelog. #1}
\addcontentsline{loc}{changelog}{\protect\numberline{\thechapter.\thechangelog} \hspace{0.3em} #1}\par
}
\title{Minimal Example}
\author{Andre Santos}
\date{November 2021}
\begin{document}
\listofchangelog
\pagebreak
\chapter{Test Chapter}
\lipsum[0]
\change{First Change}
\lipsum[1]
\lipsum[2]
\pagebreak
\change{Second Change}
\lipsum[3]
\end{document} And the List of Changes is generated properly. Instructions to Reproduce the Error
Expected behavior Additional context Full log:
The relevant part indicates the problem with the counter:
Maybe this is a package conflict? Or maybe I should move the code to another place? Note |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 2 replies
-
After some researching, the following works, without the \newcommand\listchangesname{List of Changes to Document}
\newlistof{listofchanges}{loc}{\listchangesname}
\newlistentry[chapter]{change}{loc}{0}
\newcounter{changectr}
\setcounter{changectr}{0}
\newcommand{\change}[1]%
{
\refstepcounter{changectr}%
\addcontentsline
{loc}%
{change}%
{\protect\numberline{\thesection}{\ignorespaces Change \thechangectr - #1}}%
{\large\textbf{Change \thechangectr - #1}} \par
} Here I also defined a custom counter Maybe its the Shall I keep this open? |
Beta Was this translation helpful? Give feedback.
-
Firstly, this will be a little bit off-topic. I never thought about inserting the changes as custom command directly into the document and adding an index of changes. If you're tracking changes to the document, I have to-do notes like Add todo notes to your document, but a little bit more elaborated. But this (your snippet) is a great resource. Secondly, have you considered using Lastly, about your question. You have this: As your error log said, \newcommand{\listanswername}{List of Answers}
\newlistof[chapter]{answer}{ans}{\listanswername}
\newcommand{\answer}[1]{%
\refstepcounter{answer}
\par\noindent\textbf{Answer \theanswer. #1}
\addcontentsline{ans}{answer}{\protect\numberline{\theanswer}#1}\par} The According to your first post, the correct would be. \newcommand{\listchangename}{List of Changes}
\newlistof{changelog}{loc}{\listchangename}
\newcommand{\change}[1]
{%
\refstepcounter{change}%
\par\noindent\textbf{Change \thechange. #1}
\addcontentsline{loc}{changelog}{\protect\numberline{\thechapter.\thechange} \hspace{0.3em} #1}\par
} Because you wanted a global counter, you had to have Bottom line, your WORKING solution is TOTALLY CORRECT, given that is what is in the This is not a bug, but would be great in the Q&A. Just answer the question about |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer. I think its pretty evident I am a complete noob in LateX and had no idea about the existence of About the counter, I apologize, it is not reseting but rather indicating me the chapter the change appears on followed by
And both have the same If I manually do: \refstepcounter{change}% It works as By the way, you mean Do I not need Here's the full working code of what I have (
|
Beta Was this translation helpful? Give feedback.
-
Please leave the issue open until I have time to check this error and (possibly) include your solution in the template. Thanks. |
Beta Was this translation helpful? Give feedback.
-
@joaomlourenco do you think that there's a bug? |
Beta Was this translation helpful? Give feedback.
-
I don't think this is a bug, it was probably my misuse of the package. Also, given there's a more stable and robust package ( |
Beta Was this translation helpful? Give feedback.
-
Well, @joaomlourenco is the template's maintainer and he knows its "cogs and leverages" 😄 by heart. The answer that he gave maybe it's to see the issue with more calm and time. Anyway, the The craftsman uses a tool for his craft, and the craft is what's important. The tool is what the craftsman thinks is better for him to accomplish the goal of his craft. If it works it's a good tool, if it doesn't it isn't 😉 |
Beta Was this translation helpful? Give feedback.
-
@andrfgs I spoke with the maintainer and he confirmed that he didn't see with time and had the intention to read with greater attention. @andrfgs if you're going to use Then you have to put them at the bottom of the file %DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF UNDERLINE PREAMBLE
\RequirePackage[normalem]{ulem}
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1}
\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}}
\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}
%DIF SAFE PREAMBLE
\providecommand{\DIFaddbegin}{}
\providecommand{\DIFaddend}{}
\providecommand{\DIFdelbegin}{}
\providecommand{\DIFdelend}{}
%DIF FLOATSAFE PREAMBLE
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}}
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}}
\providecommand{\DIFaddbeginFL}{}
\providecommand{\DIFaddendFL}{}
\providecommand{\DIFdelbeginFL}{}
\providecommand{\DIFdelendFL}{}
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF Then you can apply Bear in mind that, generally, you will want to invoke
(the –flatten argument makes Then you could apply pdfLatex ( I'll try to make scripts to facilitate the usage without having to put something in the preamble, as well as make a workflow, etc. References |
Beta Was this translation helpful? Give feedback.
Thanks for the answer. I think its pretty evident I am a complete noob in LateX and had no idea about the existence of
latexdiff
package. It seems I unnecessarily reinvented the wheel... I'll check it out and probably switch to it. I also got very confused about what package implemented these commands.About the counter, I apologize, it is not reseting but rather indicating me the chapter the change appears on followed by
.0
So 2 changes at chapter
x
for some reason have the following format:And both have the same
.0
value, becoming indistinguishable.I now realized I am supposed to manually update the
change
counter. I was under the imp…