« first day (3685 days earlier)      last day (93 days later) » 
00:00 - 22:0022:00 - 00:00

10:06 PM
@UlrikeFischer I just posted a "not my fault" answer, and I didn't even blame you.
 
@DavidCarlisle the \par question?
 
@UlrikeFischer yes
 
@DavidCarlisle Could one implement a \centering which doesn't use \par?
 
@UlrikeFischer yes \linebreak works for example.
\documentclass{article}

\parskip=1in
\begin{document}

\begin{center}
  aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
  aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
  zzz\linebreak zzz aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
  aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
\end{center}

\begin{center}
  aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
  aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
  zzz\\ zzz aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa
@UlrikeFischer ^^
 
@DavidCarlisle ? why don't I get a parskip in the second case? I thought it would issue a \par too.
 
10:23 PM
@UlrikeFischer well you do, but you also get \addvspace{-\parskip}
 
@DavidCarlisle that's cheating ;-(
 
@UlrikeFischer \everypar{blub} better example to expose the internal par I suppose
 
tsj
I'm learning about `\expandafter` from this article: https://www.overleaf.com/learn/latex/Articles/How_does_%5Cexpandafter_work:_A_detailed_macro_case_study
The example in question (taken from the e-Tex manual) is
```
\def\foo#1#2{\number#1
\ifnum#1<#2,
\expandafter\foo
\expandafter{\number\numexpr#1+1\expandafter}%
\expandafter{\number#2\expandafter}%
\fi}
Oops -- I'm confused about the last \expandafter. I took it out and the macro still works as expected. Is there any reason for including it?
 
@tsj It expands \fi to get it out of the way
 
@tsj it's needed to expand (remove) the \fi
 
10:28 PM
@DavidCarlisle So slow :)
 
@PhelypeOleinik a character more
 
@DavidCarlisle I'm concise
 
@PhelypeOleinik I can spell
 
@DavidCarlisle That's evil :)
 
tsj
Would \fi not be 'removed' anyway? Why does the macro still work if I take out the last expandafter?
Thank you both ;)
 
10:31 PM
@tsj actually the macro isn't very good, that final expandafter will only remove the final fi if it is expanded and that will only happen if #2 is an incomplete number. If it is a count register for example, the expansion would terminate there.
@tsj no, and it doesn't. Look at a simpler example. ...
\iftrue \fbox\fi{z} compared to \iftrue\expandafter\fbox\fi{z}
@tsj in the first case the argument of \fbox is \fi (and everything goes wrong) in the second case the \fi is removed and the argument of \fbox is z
@tsj if you look in latex.ltx source of the latex format you will see this \expandafter\something\fi construct all over the place.
 
tsj
There's no use in using expandafter here though right: \iftrue \fbox{z\expandafter}\fi
 
@tsj true, it wouldn't even expand the \fi in that case it would apply to \kern (which isn't even expandable.)
\newdimen\fboxsep
\DeclareRobustCommand\fbox[1]{%
  \leavevmode
  \setbox\@tempboxa\hbox{%
    \color@begingroup
      \kern\fboxsep{#1}\kern\fboxsep
    \color@endgroup}%
  \@frameb@x\relax}
@tsj ^^
 
10:57 PM
@UlrikeFischer I am sorry for bothering but do you have any recommendation about how to have the following lines inside the \ExplSyntax code?

\newlength{\headerTotalHeight}
\AtBeginDocument{\settototalheight\headerTotalHeight{\headerContents}\geometry{headheight = \headerTotalHeight}}
 
@Plergux @HaraldHanche-Olsen Icelandic, Norwegian, Danish and Swedish (along with Middle English and Middle French) featured prominently in today's class. :)
 
11:12 PM
@Diaa no sorry I didn't have the time to look at your code.
 
@DavidCarlisle \@firstoftwo ;)
 
@JosephWright @Skillmon would have us replace them all with \def\foo#1\fi{\fi#1 and save a millisecond or two
 
@DavidCarlisle :)
@DavidCarlisle, @egreg, @UlrikeFischer, @PhelypeOleinik (@MarcelKrüger) I've had a request in Another Place to look at integrating l3fp-functions into the core of l3fp: it does something similar to \pgfmathdeclarefunction.
 
@JosephWright I've got no objection
 
@DavidCarlisle, @egreg, @UlrikeFischer, @PhelypeOleinik (@MarcelKrüger) I'm wondering about Bruno's approach of using symbolic variables in the expression vs. the pgf one of using standard TeX ones (#1, etc.): thoughts?
@egreg You think the syntax is OK?
@egreg I'm not sure exactly how much of the 'extras' are needed
 
11:23 PM
@JosephWright I didn't study it, sorry
 
@egreg That's OK, I'm having to look back myself and use the test files as a reminder :)
 
@JosephWright oh we have something like l3fp-functions ? ;-)
 
@UlrikeFischer :)
 
@JosephWright Where can I find it?
In any case it would surely be a good addition! Variables too!
 
tsj
@DavidCarlisle Hmm, so TeX would always finish expanding the 'outer macro' (fbox) thus replacing #1 with 'z\expandafter' before expanding 'inner macros'? It does a breadth-first instead of a depth-first?
 
11:27 PM
@egreg It's in l3trial on GitHub: it's not part of the release material
@tsj Yes, TeX just expands as it goes along: when you grab an argument, you get exactly the tokens they are, not their expansion (unless you take steps to arrange that)
 
@tsj remember it is a macro substitution language so it works by textual substitution, \fbox expands to its definition with #1 being filled in by whatever it picks up, then expansion processing starts again from the first token in the replacement text of \fbox
 
tsj
@JosephWright I had been operating under the assumption that \expandafter was a step to arrange expansion. If not expandafter, what would cause an earlier expansion?
And, I still don't see the point of including the last \expandafter in the example I first posted. There's no argument list to interrupt as in your (@DavidCarlisle) fbox example, and compiling in an MWE it does still produce the expected output if I omit the final expandafter
 
@JosephWright \fp_set_function:nnn {myfunction} { x,y,z } { sin(x)+cos(y)*exp(z) }?
 
@tsj there was a recursive call on your macro wasn't there?
 
tsj
@DavidCarlisle yes
 
11:33 PM
@tsj well there you go then, hang on I'll post the example...
@tsj oh ok perhaps I won't as the recursive call is picking up all its arguments within the fi. so the observable behaviour is the same other than leaving the fi in the input stack means that you do use up stack space whereas the form with fi remove dis tail recursive and no stack is used. But probably need a big example these days to actually error.
@tsj here:
\documentclass{article}

\begin{document}
\def\foo#1#2{\number#1
\ifnum#1<#2,
\expandafter\foo
\expandafter{\number\numexpr#1+1\expandafter}%
\expandafter{\number#2\expandafter}%
\fi}

{
%\tracingonline=2 \tracingmacros=2

\foo{2}{10000}
}

\def\fooB#1#2{\number#1
\ifnum#1<#2,
\expandafter\fooB
\expandafter{\number\numexpr#1+1\expandafter}%
\expandafter{\number#2}%
\fi}

{
%\tracingonline=2 \tracingmacros=2

%\fooB{2}{10000}
}


\end{document}
It runs without error, but comment out the \foo{2}{10000} line and uncomment the \fooB{2}{10000} and see the difference
 
tsj
Ah okay. I actually get an error for the second case, TeX capacity exceeded
 
@tsj \foo is making a tight loop, but each iteration of \fooB leaves a copy of \fi pushed on to the input stack (which has size 5000 by default in texlive)
 
tsj
Yes
 
@tsj but to be honest we didn't analyse your example to check that was the case before saying the \expandafter is needed. After doing this for a decade or two if you see a \fi you worry if you don't see code forcing its premature removal, it always bites you somewhere.
@tsj and we used to worry about this more. 5000 is quite big but the example in the texbook has ! TeX capacity exceeded, sorry [input stack size=80]. so in the mid 80s the stack size limit was 80 which was rather easier to hit...
 
tsj
11:54 PM
@DavidCarlisle Very illustrative, thank you. So in the case without expandafter, all the \foo macros are expanded before the first (inner-most) \fi is processed, at which point you already have a stack of 10000 of them
 
@tsj yep
 
tsj
That would contradict what I had assumed from @JosephWright statement about depth versus breadth, but presumably it varies case by case. I'll see if I can work out by hand exactly how TeX expands \foo{1}{2}
 
00:00 - 22:0022:00 - 00:00

« first day (3685 days earlier)      last day (93 days later) »