« first day (5224 days earlier)      last day (2 days later) » 

00:52
@CarLaTeX -- Yay!
 
2 hours later…
02:40
@cfr Yes, this was based on my misunderstanding of the hook system. I was expecting it to behave roughly like the code that used the other counter.
@cfr So the correct way to do it with hooks seems to be:
\documentclass{article}
\newcounter{mytot}
\newcounter{mytotal}
\usepackage{etoolbox}
\newenvironment{mylist}
{\begin{enumerate}
\pretocmd{\item}{\stepcounter{mytotal}}{}{}}
{\end{enumerate}}
\AddToHook{env/mylist/begin}{
\AddToHook{env/enumerate/begin}{\pretocmd{\item}{\stepcounter{mytot}}{}{\fail}}
}
\AddToHook{env/mylist/end}{\RemoveFromHook{env/enumerate/begin}}

\begin{document}
\themytot
\begin{mylist}
\item Foo
\item Bar
\end{mylist}
\themytot

\begin{enumerate}
\item Foo
\item Bar
\end{enumerate}
cfr
cfr
03:35
@AlanMunn no. you shouldn't do \RemoveFromHook{env/enumerate/begin} because something else might have added code there. if you must remove it, you can either create a custom hook or just use a label and then remove only the code for that label.
@cfr I guess that makes sense. So it's all and all more complicated to do this with hooks.
cfr
cfr
@AlanMunn you could just use \AddToHookNext, couldn't you?
@AlanMunn more complicated than what?
@cfr You're wildly overestimating my knowledge of hooks. :)
@cfr The code I'm modifying isn't mine, so it's simpler to redefine the relevant environment (roughly like the code that uses the other counter in my example).
cfr
cfr
@AlanMunn what are the counts supposed to be?
@cfr The package uses an enumerate environment inside another environment, and the goal is to count the total number of items in just those enumerate environments.
@cfr Does this solve the RemoveFromHook problem:
\documentclass{article}
\newcounter{mytot}
\newcounter{mytotal}
\usepackage{etoolbox}
\newenvironment{mylist}
{\begin{enumerate}
\pretocmd{\item}{\stepcounter{mytotal}}{}{}}
{\end{enumerate}}
\AddToHook{env/mylist/begin}{
\AddToHook{env/enumerate/begin}[list]{\pretocmd{\item}{\stepcounter{mytot}}{}{\fail}}
}
\AddToHook{env/mylist/end}{\RemoveFromHook{env/enumerate/begin}[list]}

\begin{document}
\themytot
\begin{mylist}
\item Foo
\item Bar
\end{mylist}
\themytot

\begin{enumerate}
\item Foo
\item Bar
@cfr I only used two counters in the sample to show the solution with and without hooks.
@cfr Each makes an convivial guest, but you do not want to invite them to the same party. what a great line! I totally agree too.
cfr
cfr
03:54
@AlanMunn yes, but it won't work properly if you have multiple enumerate inside a list. also, it will affect other enumerate-like environments, if nested?
@AlanMunn did I really use an?
@cfr No I don't think so. There won't be embedded enumerates, and the hook is only set inside the environment and then unset again.
@cfr I guess you did. :) I just copied and pasted. I hadn't noticed.
cfr
cfr
@AlanMunn always a risky strategy.
@cfr :)
cfr
cfr
@AlanMunn ouch. I changed it now, though.
@cfr One of those "thinking one word and writing another" I guess. You maybe had a different word in mind for 'convivial', maybe 'attractive' or something else that begins with a vowel and changed your mind mid sentence.
cfr
cfr
03:59
@AlanMunn then, yes. if you have exactly one enumerate inside the list, it should work.
@AlanMunn I wouldn't give me so much credit ;).
@cfr Yes, because the enclosing environment is essentially a wrapper for a single enumerate environment (with some extra stuff above it)
cfr
cfr
@AlanMunn so couldn't you use
\AddToHook{env/mylist/begin}{
  \AddToHookNext{env/enumerate/begin}{\pretocmd{\item}{\stepcounter{mytot}}{}{\fail}}
}
@cfr Maybe? Does that eliminate the need to remove the hook?
cfr
cfr
if you have exactly one enumerate in mylist, you can just add it to the next enumerate, maybe?
@AlanMunn yes.
@cfr So then yes I guess I could. This is my first real attempt to mess with hooks other than the occasional cut and paste, which as a wise person recently told me is always a risky strategy. :)
cfr
cfr
04:07
@AlanMunn so the Next thing affects only the next use of the hook. so if you know you have exactly one and it is the next one and you don't want it to change any later ones, you don't need to bother with labels and deletions and stuff. at least, that's how I understand it. (and it seemed to work the way I expected when I played with it last summer.)
@AlanMunn have you tried tl25?
@cfr No, I don't really have time to mess with it at the moment.
cfr
cfr
@AlanMunn I have never tried any pretest as far as I recall. my general strategy is to hope other people find the bugs first.
@cfr I'm the same. It also usually arrives at a busy time in the semester. I'm also very slow to update my OS on the Mac. But I do keep my TL updated.
cfr
cfr
@AlanMunn I'm still trying to figure out why Google gave me this for vicious circle cartoon.
@AlanMunn isn't that backwards? I assume the OS is more likely to have a security issue. or do you mean to a new release?
@cfr Very weird. I'm not sure I get the cartoon either.
@cfr No, I do keep it updated, but I don't install new versions. For example I'm still one version behind on my current Mac.
cfr
cfr
04:18
@AlanMunn yes. I don't get it as a result and I don't really get it either. something I don't know about carrots? or rabbits?
@AlanMunn that is not much, though. different if you think an update will fix something rather than creating things to fix.
@cfr Or tortoises and shells? No idea.
cfr
cfr
@AlanMunn glad it isn't just me, anyway.
@cfr Well Apple keeps giving me little reminders that I should install Sequoia (the latest version of the OS) to improve my productivity. Since this seems an outlandish claim, I resist. :)
@cfr Anyway nice chatting with you as always. Time for bed for me.
 
2 hours later…
06:03
@DavidCarlisle No problem, only 598,000 points left
 
3 hours later…
08:53
Is \AtEndDocument too late for \property_record:nn?
@JasperHabicht No, it's OK: it's the enddocument hook - see texdoc lthooks
@JosephWright Hm, then ... I need to check what's going on
09:40
@JasperHabicht MWE?
10:00
@JosephWright I guess, it is (again) one of these issues where the problem is solved as soon as I can come up with a MWE
@JasperHabicht were floats at the end involved?
@UlrikeFischer I use [pagestyles]titlesec and titletoc, so I append headers and footers and create minitocs ... there are no floats
If I look in the .aux, there is the \gdef \@abspage@last{9} value at the end, so this seems to be right. The last thing before that is \ttl@finishall which is from the titletoc package. \AtEndDocument seems to work, but properties won't be written to the .aux for whatever reason.
I try to comment out stuff that might interfer now
10:43
@UlrikeFischer Could you elaborate on that? Maybe it is the issue ... if I force LaTeX to issue a new page with "xxx", the properties are written to the .aux file
@UlrikeFischer it's "floats at end of document" week
If I use \AddToHook{shipout/lastpage} it works
11:04
@DavidCarlisle ;-)
11:22
@Skillmon You are making breakthrough discoveries in mathematics? :P
11:42
@UlrikeFischer Tested pdflatex-dev on some of the book (in memoir) manuscripts I have, they all compile as normal and seems ok. As I don't know what changes there are I haven't tested further.
12:00
For \property_new:nnnn {⟨property⟩} {⟨setpoint⟩} {⟨default⟩} {⟨code⟩}``ltproperties-doc says: "The expansion of ⟨code⟩ (the value of the property) is written to the .aux file and read back from there at the next compilation." ... What should I do, if I want to control expansion of what I put as ⟨code⟩? \exp_not:n seems to have no effect there ... or maybe I am missing something.
@samcarter yes, of course :)
@daleif well until yesterday you should have got wrong headers, but with a new textcase it should be ok.
Ah, shipout ...
12:52
@UlrikeFischer Did not look at the headers, plus I always remove the upper casing in my book designs.
 
2 hours later…
14:52
@UlrikeFischer This question got bumped because of a tag edit and reminded me of what a superb answer you gave to it.
 
2 hours later…
16:32
I probably need to learn more about floats …
16:46
@JasperHabicht Here is a good example of a float to start your learning experience: media.zenfs.com/en_us/News/Reuters/… :)
@samcarter =) great!
Or maybe I just read through ltfloat
17:20
@AlanMunn ;-)
18:06
Or ltoutput maybe
 
1 hour later…
@DavidCarlisle Yes, I already read this (although I know about the positioning mechanism roughly, but I am interested in the output routines).
 
3 hours later…
cfr
cfr
22:04
how do I get docstrip to use \end{document} rather than \endinput? I'm pretty sure I've even done this somewhere ....
@cfr normally you have \end{document} in the source?
cfr
cfr
@AlanMunn sorry. was too tired to think.
@DavidCarlisle I thought I had not to do that? or is that \endinput?
@cfr I don't think I understand the question. indentfirst.dtx for example has
%<*driver>
\documentclass{ltxdoc}
\usepackage{indentfirst}
\GetFileInfo{indentfirst.sty}
\begin{document}
\title{The \textsf{indentfirst} package\thanks{This file
        has version number \fileversion, last
        revised \filedate.}}
\author{David Carlisle}
\date{\filedate}
\MaintainedByLaTeXTeam{tools}
\maketitle
\DocInput{indentfirst.dtx}
\end{document}
%</driver>
cfr
cfr
@DavidCarlisle thanks. I think I'm confusing it with \endinput. I have a .tex file in the .dtx.
@cfr \endinput is more or less never needed, it just stops a file being read so following lines are essentially treated as comments, in the usual case, where it's the last line, it does nothing
cfr
cfr
22:18
@DavidCarlisle well, tell docstrip.
\end{document}
\endinput
%%
%% End of file `ebgaramond-example.tex'.
@cfr yes I know but in that form where \end{document} has been added from the source \endinput isn't even executed so it really doesn't matter what is there
cfr
cfr
@DavidCarlisle I just meant: I'm not actually adding it here. at least, not directly.

« first day (5224 days earlier)      last day (2 days later) »