« first day (3351 days earlier)      last day (1597 days later) » 

12:45 AM
Can I replace \relax with \def to ensure that a user doesn't provide \relax as parameter?
https://tex.stackexchange.com/a/521292/141768
\def\zTest#1{\afterassignment\zTestAux\count255=#1\def}
\def\zTestAux#1{\ifx\def#1\else\ERROR\expandafter\zTestGobble\fi}
\def\zTestGobble#1\def{}
 
@bp2017 You can, the same way you can do \def\begin{\relax} :-)
@bp2017 I still advise to do \let\RenamedRelaxThatNoReasonableUserWillInput\relax and then use \RenamedRelaxThatNoReasonableUserWillInput
 
@PhelypeOleinik, thank you. But \let won't work:
\let\zTerminator\relax
\def\zTest#1{\afterassignment\zTestAux\count255=#1\zTerminator}
\def\zTestAux#1{\ifx\zTerminator#1\else\expandafter\zTestGobble\fi}
\def\zTestGobble#1\zTerminator{}
\zTest{3\relax.4}
 
@bp2017 Depends on how you define "work". It doesn't detect that the input is wrong because the #1 in \ifx\zTerminator#1 is \relax, so the test is true. The same would happen if you used \def and the user did \ztest{3\def.4}.
@bp2017 Try this:
\let\zTerminator\relax
\def\zTest#1{\afterassignment\zTestAux\count255=#1\zTerminator}
\def\zTestAux#1\zTerminator{\if\relax\detokenize{#1}\relax\else\errmessage{Wrong input #1}\fi}
 
 
2 hours later…
3:15 AM
@cis You can do such things relatively easily using Lua. I've used a Lua Regex library (not Lua's built-in patterns) to do exactly that.
@cis Here is my code. I kind of hate regular expressions and all their kith and kin, but I thought it might be good for me to learn some of that. Actually, it only took me a couple of days of futzing around.
local rex = require "rex_pcre"

local function basename (filename)
   local bn = rex.new("(?=[^/]+$)(.*(?=[.])|.+)")
   return bn:match(filename)
end
Of course, you need to set things up so that TeX's Lua will find a path to a third-party library, but there is a package for that.
 
4:17 AM
And that uses PCRE: Perl Compatible Regular Expressions.
 
 
2 hours later…
6:28 AM
"The same would happen if you used \def and the user did \ztest{3\def.4}."
@PhelypeOleinik, that's weird because if user does \ztest{3\def.4} it doesn't compile (in XeLaTeX at least; although error is not produced).

Thank you for \detokenize version.
 
 
4 hours later…
10:09 AM
@FaheemMitha but loading a regex library just to split on a fixed string like / seems over-kill you could do it just as simply in base Lua, or TeX, without the overhead of external Library access.
 
I think I might suffer from anatidaephobia, the fear that I'm constantly being watched by a duck, because whenever I star a repo on GitHub, @PauloCereda immediately stars it too.
8
 
@DavidCarlisle Possibly, but it's much easier with regex.
Plus everyone knows regex.
Well, everyone who is tortured themselves sufficiently. Unix and Perl people, mostly.
And that regex does a bit more than split on /.
 
@HenriMenke ooh
 
10:29 AM
@FaheemMitha not really, the Lua pattern version would be more or less the same , or you could use \filename@parse in latex.
 
@DavidCarlisle I forget the details, but it's wasn't super trivial. It's not so easy to handle all the edge cases correctly.
 
@FaheemMitha which rather contradicts your statement that it's much easier with regex
 
@DavidCarlisle Well, one can handle the edge cases with regex in one expression, so no.
I meant it's easier than Lua pattern matching.
If I recall correctly, one had to do more than one pass to handle edge cases correctly.
 
@FaheemMitha regex is in general more expressive than lua patterns but in this case I think that makes no difference
 
But again, I forget the details, and I didn't make careful notes or create a test script, because it didn't seem that important.
 
10:32 AM
@DavidCarlisle correct
 
@DavidCarlisle Perhaps I should have asked you for help. :-)
 
 
1 hour later…
12:02 PM
anyone around with an up to date windows tl2019? could you try this?
@VincentYin I thougfht you would have an old version of some package but the file versions are the same for all files except my setup includes ctex-fontset-fandol.def 2019/05/29 v2.4.16 Fandol fonts definition (CTEX) and yours ctex-fontset-windows.def 2019/05/29 v2.4.16 Windows fonts definition (CTEX) ctex-fontset-windowsnew.def 2019/05/29 v2.4.16 Windows fonts definition for so I'm not sure, I'll have a look at that windows file..... — David Carlisle 7 mins ago
 
12:13 PM
@DavidCarlisle I can look.
 
@UlrikeFischer I can't see anything in the def files, I'm wondering if the OP doesn't have PL3 format, waiting for confirmation...
 
@DavidCarlisle I don't have the fonts, it doesn't compile at all for me.
 
@UlrikeFischer Same here
 
12:59 PM
@bp2017 With "the same" I meant "almost the same" ;-) The general behaviour is still the same: the \def token in the input will terminate the scanning, and the code (\ifx\zTerminator#1) will think that everything went okay. Then the rest of the input will be typeset (.4) and the \zTerminator (last token in \zTest) will do its thing. If it is \relax, then nothing happens (that's what \relax does). If it is \def, then it starts a definition (and what happens then will depend...).
 
 
4 hours later…
4:57 PM
When I try to load latex.org, my browser says that the certificate has expired. Is it the same for you?
 
@Just_A_Man Probably @StefanKottwitz needs to update something
@Just_A_Man You after the forum there?
 
@JosephWright It's not urgent. Thanks @StefanKottwitz in advance for dealing with it.
 
hi, is there any code in tikz like this flowchart?

\if n=0 (an input parameter to \newcommand), do not draw,
else, draw
\fi
 
5:17 PM
@EnthusiasticEngineer not clear what you mean, but perhaps \ifnum#1=0 \else .... \fi (nothing to do with tikz though, particularly)
don't omit the space after 0 or bad things happen
 
@DavidCarlisle I am posting a question with a MWE...
 
5:39 PM
0
Q: How to get Tikz to ignore drawing on some conditions?

Enthusiastic EngineerI am trying to develop part of my code, under the condition that if some variable inputs of the functions are equal to zero, tikz do not draw some parts of the drawings. Here is a MWE (although the MWE does not work since I could not handle the condition here): \documentclass[border = 2mm]{stand...

 
 
1 hour later…
6:40 PM
@Just_A_Man @JosephWright Certificate was updated, but I forgot to restart the web server afterwards - done. Thanks!
 
@StefanKottwitz Cool
 
7:04 PM
@StefanKottwitz Thx!
 
7:28 PM
4
A: How to get Tikz to ignore drawing on some conditions?

David CarlisleI think you are looking for: \newcommand{\drawin}[1]{% \ifnum#1=0 \else \draw (0,0) -- (#1,0) -- (#1,#1) -- (0,#1) -- (0,0); \fi }

@DavidCarlisle thank you @DavidCarlisle your answer was exactly what I was looking for.
 
@EnthusiasticEngineer same as my comment above, but with the... filled in :-)
 
I was not sure how to write in multiple lines, and the procedure of if then flowchart was a little vague for me...
I do not know much about tex programming. Looked at TeXbook, seems there are many ifs like \ifnum, etc. In FORTRAN or python we only have one if!
 
@EnthusiasticEngineer Different types of comparison
 
@JosephWright how?
 
@EnthusiasticEngineer Well \ifnum is comparing two <integer denotations>, \ifx is comparing meaning, \if is comparing character code, ...
 
7:42 PM
@JosephWright I think in TeX most of what a text comparison or conditional is needed, are declared as separated ifs... in FORTRAN for instance, we have a function and any requested functionality is returned by functions after if...
 
7:59 PM
@EnthusiasticEngineer lines almost never make any difference in tex, a line end is a space (except when it isn't)
 
@DavidCarlisle thank you :-)
 
@JosephWright did we (team) write anywhere about recommendations for having user doc separate or merged with the source listings, or was that just internal discussion (thinking about my texdoc thread on texlive list)
 
@DavidCarlisle Internal only
 
@JosephWright ah thanks
 
 
3 hours later…
11:35 PM
Hello at all. Haven’t been here for years. So; Happy New year!
 
@Speravir hi, nothing's changed much:-)
 
Actually I want to ask some things:
@DavidCarlisle Is it intentional that in tabu-issues-for-future-maintainer/tabu (https://github.com/tabu-issues-for-future-maintainer/tabu) the release ZIP of v.2.10 contains `tabu.sty` v.2.9?
Ha, David ;-)
 
@Speravir possibly not, but basically 2.10 was abandoned as issues were raised on it before it went to ctan
 
@Speravir Hi!
@DavidCarlisle quack
 
@Speravir ^^^ see what I mean?
 
11:44 PM
@DavidCarlisle Yes I read this. But from my side I can tell you that updating a file needed version 2.10. Could ther be some option? Either 2.9 or 2.10 abilities as default and the other as package option? And yes I see the rubber duck. big grin Hello, eehm, quaack!
 
ooh quack indeed
 
@Speravir unless someone volunteers to pick up tabu it is essentially frozen, sorry.
 
@DavidCarlisle At least, anyone can download version 2.10 by hand (but so it will not be packed for the distributions …).
 
@Speravir if you really want tabu it's best to revert array/longtable/tabu all to the 2018 versions (that's what we helped the doxygen maintainers to do)
 
@PauloCereda Paulo, you are in danger in christmas time and early year. Ducks are veeery delicious!!!
 
11:49 PM
@Speravir oh no
@Speravir Thankfully, no one eats ducks for Christmas in Brazil :)
 
@Speravir if a competent person volunteers they are welcome to fork the repository (or have write access to that one) but I simply don't have the bandwidth to make any checkins to that code
 
@DavidCarlisle Eehm, I did not use LaTeX for years (that'S why I am not active here anymore).
 
@PauloCereda you could be exported
@Speravir I've not really used it this century:-)
 
@DavidCarlisle ;-)
 
@DavidCarlisle oh no
 
11:54 PM
@DavidCarlisle I do not really remember why I opted for tabu then (I would have to take a deeper look into code that I partly do not understand anymore), but somewhere you wrote yourself about useful parts. Perhaps these could be implemented elsewhere.
 
@DavidCarlisle I actually have heard of this recipe. :) And... OH NO
 
@Speravir if someone volunteers to do that yes, obviously it could be split up
 
@DavidCarlisle tabu-fixed here we go? :)
Tabu Support Group
 
@Speravir tabu has some good ideas, but some terrible user interface design, and a very large code base of somewhat variable quality that is essentially undocumented in its internals and more or less impossible to make compatible with the new color-safe code in the array package without being re-written. If someone is really motivated they could re-write it to be compatible, but just stating that it doesn't work any more won't actually change anything,
 

« first day (3351 days earlier)      last day (1597 days later) »