« first day (1454 days earlier)      last day (3462 days later) » 

7:40 AM
 
8:11 AM
@PauloCereda You've been serial.
 
Hi egreg!
Hello David
 
@nagylzs Hi!
 
I'm trying to get some help on longtable internals. Can you please help?
I have read longtable.dtx and still looking for an answer.
I'm not an expert...
There are values stored in the aux file for tables, with names \LT@i \LT@ii etc.
Is there a way to get the name of the current longtable from inside a longtable?
I went through the documented internals, but I cannot find this.
 
@nagylzs AS @DavidCarlisle :-)
@nagylzs The 'name'?
 
Well not the name of the table, but the entry that stores column widths in the aux file
 
8:16 AM
@nagylzs Add that you need this for typesetting cricket scoresheets, so @DavidCarlisle will run for an answer.
 
:-)
I need this because I want to make it easier to create flexible multi columns.
 
@nagylzs you should ignore people in this chat room, they are all very rude
 
No problem.
 
@nagylzs I answered your question in a comment on the answer (I hope)
 
\csname LT@\romannumeral\c@LT@tables\endcsname
I see
Great!
I hope I'll be able to use that to generalize that macro :-)
Thank you! I'll be playing with it and get back if you don't mind.
I'm really interested in this, but feel I don't know enough.
 
8:20 AM
note that if you are doing this before starting the table you will need 1 more than \c@LT@tables as incrementing the counter is first thing it does
@nagylzs heiko had an answer on site not so long ago for the simpler case of adding up all the widths (to set the caption) but he wrapped it in a more usable macro I'll see if I can find it
 
Thank you
 
@egreg: I was spotted?
 
@nagylzs wasn't here but google \LT@entry found it:-) ^^^^
 
En route to SP. :)
Apparently I have an smartphony. :)
 
8:27 AM
@DavidCarlisle \LTgetwidth, I see.
@DavidCarlisle So it will be \csname LT@\romannumeral\numexpr\value{LT@tables}+1\relax \endcsname
 
@David: It is your turn to be serial upvoted. :)
 
@PauloCereda that should always be the case
 
@ChristianHupfer Don't forget to add yourself to the list :-)
 
Seem to be empty

\begin{longtabu} to \linewidth {X}
ENTRY= \csname LT@\romannumeral\numexpr\value{LT@tables}+1\relax \endcsname \\
\end{longtabu}

What am I doing wrong
 
@DavidCarlisle Seems it's my fault that @egreg stole this tick from you.
 
8:35 AM
@MickG Clearly you accepted the wrong one!! — David Carlisle 19 secs ago
 
@DavidCarlisle I wonder what he will think of that :-)
 
@DavidCarlisle Oh I see. By adding csname I get the value, without csname its value is the name. Sorry.
 
@nagylzs you need to check for it being undefined and do something else the first time (see my answer)
 
@DavidCarlisle Great! I'm making progress. I have figured out that I need to use \ifcsname to test if the corresponding \LT@ is defined. :-)
 
8:55 AM
@DavidCarlisle If the name is not defined then mspec is defined as \def\mcspec#1{}, but shouldn't it be \def\mcspec#1{\multicolumn{3}{l}{}} ? Or that does not matter, because I'll have to run latex again anyway.
 
9:27 AM
@nagylzs oops I was changing it at times multicolumn would be better as otherwise the other cells in that row will get set in the wrong columns (so mess up teh column width measuring) I should probably fix that answer:-)
@nagylzs \ifcsname is the "modern" (1990's:-) e-tex way I used the classic TeX \expandafter\ifx\csname test but it comes to the same thing
 
9:40 AM
@DavidCarlisle Don't tell wipet!
 
@PauloCereda Morning! :)
 
@tohecz: quack! :)
 
10:01 AM
@tohecz: oh no! :)
 
@DavidCarlisle Thanks. I'm now working on a more general solution that saves all column widths in an array. I have almost no experience in writting latex macros so it will take a while. But I think it will worth the efforts. I have been struggling for this functionality and now it seems possible to do it.
 
@nagylzs saving all column widths in an "array" is essentially what longtable does (given that tex doesn't have arrays) one for each table. The code I showed was just accessing the widths from that structure (which is what longtable does all the time to make the various "chunks" line up)
 
@DavidCarlisle I also noticed that this code will set the width to something that was previously calculated. So it will never make the width smaller, only wider. In other words: whenever the content of any cell changes, I have to delete the aux file manually in order to get the desired result. I wonder if small overfull can break this code by widening the column width on each run.
 
10:20 AM
@nagylzs longtable avoids this problem by checking which chunk was used, if you look in the aux files at the LT@... entries each \LT@entry has two arguments the first is a chunk number, the second a length, so when it is aligning chunks in the current chunk it does not use the saved length but uses the length of the current cells, this way if you edit the entry, or even delete a table so that initially it's reading completely the wrong data as the table numbering has changed, it is OK
 
@DavidCarlisle I see, thank you! I'm not sure how the aux file is generated but I guess the code for longtable writes into this file. What I don't understand is that how defining \LT@entry can "read" these values out of the aux file.
 
10:38 AM
@nagylzs the aux is \input by \begin{document} so at that point all the \LT@iii commands from tables on previous runs are defined so a table doesn't look at the file, the macros it needs are defined (this is also how \ref works : \label writes to the aux that definition is read at begin document so \ref can have it available
 
@DavidCarlisle Okay, then how \def\LT@entry#1#2 calculates dimen1 ? By the time we define \def\LT@entry#1#2 it was already defined by the aux file right?
@DavidCarlisle Or is it "called" by longtable code somehow, when it tries to set these global LT entries?
 
@nagylzs search for \csname LT@ ;)
 
@nagylzs LT@entry doesn't calculate anything it is just the "array constructor" the length is its second argument. the way lists work in tex is then you locally define the constructor to do whatever needs doing and execute the list so within longtable LT@entry is defined to make a blank table row with cells of the given widths; in heikos answer it is locally defined to add up the widths; in my answer it was locally defined to add up the first three widths....
 
@DavidCarlisle I think I understand. It means that if I want to access actual column widths from within the table, they first needs to be saved into an array from the LT@entry constructor. Then I can use that array inside table cells to use their values for calculations freely.
@DavidCarlisle Probably I'll try to save them with arrayjob, and then try to use them.
 
10:54 AM
@nagylzs yes except that \LT@i is the array you want already (I don't know what arrayjob is)
 
@DavidCarlisle Maybe my thinking is too imperative. Usually I work with imperative languages.
@DavidCarlisle Oh really? Can I access it like \LI@i(3) for the width of the third column?
 
@nagylzs no but you could easily write an accessor \get{3}{..} if you want (not usually needed and always slower if you do:-) each \LT@i is a list of the form {\foo{}{}\foo{}{}\foo{}{}\foo{}{}} so to iterate over the whole list you don't need for i =1 to n {list(i)} you just execute the list
Oct 15 at 16:09, by David Carlisle
@PauloCereda as noted above, we like lisp..
 
@DavidCarlisle Yeah, it is clear that I'm not familiar with control structures in TeX. :-( Also not with data structures. I have no idea how to execute a list on a set of incides, for example.
Something like: \sum [3,4,5] \LT@ii
But obviously this is not the way to do it
There are different values for different chunks too. And I would need to specify the chunk of the current cell. Another special value that I don't know how to access :-(
Sorry for all of these questions.
 
no as in my answer but with \fnum\count@>2 \ifnum\count@<6 ... rather than the test I had
 
11:15 AM
@DavidCarlisle Yes, already had that part figured out. I still feel that I have to save these values somewhere but I also feel I'm wrong in this. :-) In a general solution, I should be able to use multiple invocations on mspec, so I cannot use a global variable called "dimen1". Or can I?
 
@nagylzs yes using a global variable is easiest way of getting the value out of the calculation but you'll need to save it somewhere do do this twice
 
12:16 PM
I'm confused of English (again). Is it: Let c be the maximal x such that ... or Let c be the maximum value such that... ?
 
@tohecz probably the latter (assuming x is clear from the context) or "maximum value of x such that..." if x needs to be mentioned
 
@DavidCarlisle sorry, x is not clear from the context, I just forgot to write it in the second one (you see, English confuses me once more :p )
It seems that "maximal" is slightly more vague than "maximum", which is what I need (since I give a proper definition in symbols afterwards anyways).
 
@tohecz well I don't think it's wrong but I think I'd be far more likely to use "maximum value of" (but then I'm English so have no idea at all about English Grammar)
 
@DavidCarlisle lol, ok, thanks
 
12:35 PM
@DavidCarlisle David, your macro has used the first 3 entries. When the table is long, there will be multiple chunks. How can I get the "current chunk of the current cell"? Is there an internal for that?
@DavidCarlisle In other words: \ifnum \count@>0 is not enough. I also need to examine #1 and check if it is in the same chunk. Otherwise it won't work for long tables with multiple chunks.
 
@nagylzs \c@LT@chunks Otherwise it won't work for long tables with multiple chunks yes it will it records the widest entry in the table (ie the width of the column) and also (for use in some defensive code against table edits) which chunk of the table had that wide entry. But usually it doesn't matter: if you want to span the first 2 columns it doesn't normally matter if the first column is wide because of an entry 10 chunks later
 
1:14 PM
@JosephWright how on topic is latexml? (more or less than say mathjax?) see recent question comments...
 
@DavidCarlisle I'd seen that: I suspect it's borderline at best, but we've not had lots in that area
 
@JosephWright I wasn't planning to answer the direct is it on topic question, don't know if you want to give a "mod view" there?
 
hi
I'm having a \begin{tabular} where the pipes don't really work... I use { |c|c|c|c| }, but as seen in the following picture, it's not showing up.
only the last one is shown... which is really weird.
 
@FlorianMargaine zoom in or print or whatever they'll probably come back
 
:o
indeed
.. why?
how to make sure they always show up?
 
1:23 PM
@FlorianMargaine Read the documentation to package booktabs, your problem should go away ;-p
 
@FlorianMargaine people have been reporting that every few weeks for the last 20 years, the important thing to note is IT'S NOT MY FAULT:-)
5
 
@Johannes_B thanks
@DavidCarlisle hm, seems to be a redundant issue then :P
 
We asked 100 people: What has @DavidCarlisle never said before?
 
@FlorianMargaine In a system that was really designed for colour that table would have a single colour background panel and the lines would be laid over the top, but colour is hacked into a system not designed that way (I didn't even have a colour screen when writing the color package) and what happens there is that each cell gets a separate panel and the lines go between, but the renderer has heuristics to snap lines to pixel boundaries so specifying adjacent panels is inherently fragile:
 
@FlorianMargaine just a comment: It looks strange to have a centered column where every line starts with a capital letter. I would suggest either left-aligning (and keeping only the header centered), or not capitalizing
@David: "I didn't even have a colour screen when writing the color package." LOL, a nice one :)
5
 
1:28 PM
@FlorianMargaine in the pdf the two panels are separated by exactly the width of teh rule, but if the right edge of one is rounded to the pixel boundary on the right and the left one rounds down to the pixel boundary on the left they may touch and squeeze out the rule
 
@DavidCarlisle Heck, we need PDF hinting on rules.
 
@tohecz I had \showoutput and looked where the \special went in the box log.
 
@DavidCarlisle now I don't believe you :p
 
@DavidCarlisle thanks for the explanation, enlightening :)
but... it is apparently your fault ;-)
@tohecz thanks for the feedback
 
@FlorianMargaine you're welcome (says me with the Copy Editor hat on ;) )
 
1:30 PM
@tohecz my system looked exactly like this:
74
A: How was TeX output visualised on screen, back in the day?

David CarlisleI started using TeX in 1987 on SunBSD (later sunos later solaris) using the dviview previewer from the vortex project. That is still one of the best viewers around, you could select individual characters ask what font they were in, and the rendering was as good as the (monochrome) screen could ha...

 
I've left-aligned the last column
sure looks better
 
@FlorianMargaine just please keep the header centered :)
@DavidCarlisle and you couldn't tet it by using \color{white}?
 
1:49 PM
@tohecz well not in the on screen previewers available they didn't do colour anyway.
 
2:02 PM
Barbara Beeton is having a work anniversary.
34 years this October at tex users group.
6
 
@tohecz yep, did that
 
 
2 hours later…
4:02 PM
So tired. Spent the whole day implementing a very simple thing
It seems I'm not able to add two numbers in TeX without getting help from others
:-(
1
A: Add values stored in an array

egregFirst of all you should use arrayjobx and not arrayjob (the latter is not really compatible with LaTeX). Secondly, \let\a\dimexpr will make \a equivalent to \dimexpr and try printing \cws(0)+\cws(1)\relax; then \a will produce an error just like \dimexpr \end{document} You should use \newcomm...

Adding some numbers required 16 lines of code, and the use of an experimental package that should replace \newcommand in the future
Seriously???
Why it is so hard?
 
@nagylzs Because you're using the wrong tool, that is arrayjobx.
 
I don't get it. :-( Your code also contains 11 lines and an experimental package xparse. Is it really required to use a new package, just to add some numbers?
 
@DavidCarlisle Really? We could write a blog post. Would you help me?
 
@nagylzs I'll add a package free version
 
@egreg The problem must be with my thinking. I'm used to procedural languages and it is making me crazy when I can't just add two numbers with "a+b" with three charaters.
@egreg David already did that.
 
4:11 PM
@nagylzs Well, mine is better, as always. ;-)
 
@egreg :-)
@egreg Very cryptic. Things like "#1@##1" making it hard to understand. :-(
 
@nagylzs You're not trying to do a+b, in that case: you want to use the array data type that's not directly available in TeX, so one has to build it before using it.
 
@nagylzs:
5
Q: Why is TeX/LaTeX-"programming" so different from other languages in terms of syntax?

Perik OntiUsually, e.g., when I want to have an if, I do something like this: if(value) { ... whatever code ... } But in LaTeX, its: \ifnum\count0<100 ... whatever LaTeX-code ... \fi There are no brackets and so on, for example, which indicate where if-statements begin and where they end. Als...

And also:
Just to add my humble POV, difference is in the eye of the beholder. Syntax preference is a matter of taste and ideology; if you grew up accustomed to a certain construct or command pattern, there's a tendency for labeling different representations of the same lagic as wacky or strange. :) Besides, I have the impression Maslow's hammer applies here as well. :) I remember of the arithmetic IF in Fortran and different decimal marks in ALGOL, so your mileage may vary. Personally, I believe this question turns more opinion-based. — Paulo Cereda May 24 at 11:13
:)
 
@nagylzs That's why I proposed the expl3 version, which uses a predefined data type.
 
@egreg David is busy fixing a day-zero bug in longtable, so I heard. :)
 
4:19 PM
@egreg And that predefined type would be... a property type?
@egreg Where is \prop_new:c defined? It is not in xparse, I think
 
@nagylzs No, it's in expl3 (texdoc interface3)
@nagylzs Property lists are the implementation of associative arrays in expl3. A property consists of a key and a value. You can access the value by specifying the key.
@nagylzs Note that what arrayjobx calls arrays are actually property lists (hash variables in Perl)
 
@egreg I'm familiar with associative arrays. I cannot find \prop_new in the documentation of expl3 ctan.ijs.si/tex-archive/macros/latex/contrib/l3kernel/expl3.pdf
 
@egreg Experimental modul with 243 pages of documentation. Well, latex does have a long learning curve indeed
@egreg What does ##1 mean? Tried to google it but no luck.
 
@nagylzs We're using \newcommand inside a definition, so the argument for the inner macro must be specified by ##1, because #1 denotes the argument to the outer macro. On the site there are questions about this.
43
Q: What is the meaning of double pound symbol (##1) in an argument?

adnI've seen sometimes that people use a double pound sign (##) when defining/using arguments. What is the difference between the normal argument, #1, and the double sign one, ##1? Are there any restrictions for its use? Can you list the good practices, if any, for this type of arguments.

 
4:32 PM
@egreg Thanks. So I'll have to know how many expansions there are, and I have to count them.
@egreg For me, everything seems to be overcomplicated. I'm sorry I think it is the best if I come back later, for now I'll give up.
 
@nagylzs Not really expansions, but rather levels.
 
@egreg Yes, but it is not clear to me what a level is... \def creates a new level. But there are other tokens that may or may not create a new level.
Syntactically, this appears to be a big mess for me.
 
@nagylzs Is this simple enough?
\documentclass{article}
\usepackage{pgfmath,pgffor}
\def\myarray{{2pt,4pt,5pt,-2pt,-4pt,-5pt}}
\begin{document}
\pgfmathparse{array(\myarray,2)+array(\myarray,1)}%
\edef\a{\pgfmathresult pt}%
\a

\def\a{0}
\foreach\x in {0,...,5}{% Add all
\pgfmathparse{array(\myarray,\x)+\a}\global\let\a\pgfmathresult%
}\a %No units add ptif you need.
\end{document}
 
@nagylzs You wouldn't need ##1 if you adopt the syntax proposed by David. It's the same idea, after all.
 
@egreg I can understand his code. He is defining new macros, so his solution is not a real array. But it works.
 
4:39 PM
@nagylzs It's a reference manual more than a learning guide
@nagylzs Arrays in TeX are best done using a set of macros
 
@JosephWright Wow, long post
 
@nagylzs Tricky subject
 
@JosephWright Do you think LuaTex would be better for me?
 
@nagylzs Currently, property lists in expl3 are implemented as single macros 'under the hood': that's better for csname usage (used to be important)
@nagylzs Depends on what you want to do
@nagylzs I suspect if you are coming from a more 'traditional' background you'll find Lua easier than TeX programming
@nagylzs You'll notice that the experienced TeX users will think about problems in a different way to someone used to procedural working
 
@JosephWright Yes, and unfortunately it is usually hard for me to understand. My favourite language is Python, and one of the reasons for that is its very clean syntax. I used to use perl before but it was also too cryptic. Here in LaTeX we HAVE TO pollute the local and global namespaces in order to do something useful, and I don't like that
 
4:49 PM
@nagylzs There is no namespace in TeX.
 
@nagylzs There was a talk at the last TUG meeting on creating a variant of TeX with namespacing, but for the moment we don't have it or really need it: you just have to think in the right way
 
@percusse How can I learn it?
 
@nagylzs It meaning namespaces?
 
@percusse Sorry, wrong recipient
 
@nagylzs Remember TeX was designed many years ago and for a specific reason: batch-based typesetting. Knuth didn't expect people to even write 'packages' which applied to more than one document.
 
4:51 PM
@JosephWright How can I learn thinking the right way?
 
@nagylzs Practice, I guess :-)
 
@JosephWright I have read TeX tutorials, but when I want to do something that does not already have a package, and when it comes to calculating and programming then it suddenly becomes very hard.
 
@nagylzs It's a bit like a natural language: if you start with 'this is what I want to do in my native language' and translate it, things are not quite right
 
@nagylzs I don't know if you are familiar with RPN of Postscript. Some people are way quicker with it but that doesn't mean it is the common way. Python uses the common way but TeX uses a strange state-of-thinking and you need to leave the OOP outside the door. Then computations etc comes slowly to you.
 
@nagylzs TeX wasn't really built for either
@nagylzs A big driver behind expl3 is that it provides 'programming tools', but even then we are dealing with macro expansion
@nagylzs If you want to program TeX in a 'serious' way, read The TeXbook and TeX by Topic
 
4:54 PM
@JosephWright Yes, but somebody must have programmed longtable or tabularx, so there are ways to do procedural calculations.
 
@nagylzs That would be @DavidCarlisle ;-)
 
@JosephWright I'm affraid that will be 4000 pages long :-)
@JosephWright Only 490, surprise :-D
 
@nagylzs You can do calculations, sure. The 'classical' way is to use assignments and do things one at a time, but nowadays we do have \numexpr, \dimexpr, etc. (e-TeX extensions, added in 1999)
@nagylzs longtable is about 450 lines of code, I think
(Was thinking of the source)
 
@JosephWright Yes, 450 lines of code is not very much for something like longtable.
@JosephWright Usually I write more than 500 lines per day. But first I'll have to read that Texbook. That will take a while.
 
'Classical' addition of two integers (in plain)
\count0=10 %
\advance\count0 20 %
\the\count0 %
\bye
@nagylzs 500 lines a day? How?
@nagylzs That's like 2000-3000 lines of source at least
 
4:59 PM
@JosephWright No, 500 lines of source.
 
@nagylzs What about the documentation part?
 
@JosephWright In Python, the documentation is inside the code
 
@nagylzs But not all of the lines are code, then: some are documenation
 
@JosephWright All right.
 
@nagylzs See for example longtable.dtx versus longtable.sty
@nagylzs If you want a quick insight into TeX at the low level, I'd go with TeX by Topic: texdoc.net/pkg/texbytopic
@nagylzs Expandability and the fact that arguments are passed by TeX 'as is' (not functional style) seem to be the big barriers to people with experience 'elsewhere'
 
5:13 PM
I stopped follwing this conversation when I read Python. :P
(@percusse ^^)
 
@PauloCereda You must be joking. :-)
 
@nagylzs I'm joking that I hate Python, but it's not my favourite flavour of tea, I'd put this way. :)
 
@nagylzs He is lying he hates it. He is a java man.
Historically too...
:P
 
@percusse Hey. <3
@percusse: sir you should try my epic macro expander.
 
@PauloCereda Does it blend?
 
5:19 PM
@percusse it does infinite loops in 10 seconds. :)
 
@PauloCereda Does it collect that garbage afterwards?
 
@percusse That's the beauty of it: it doesn't need to. :) You don't even need to use variables. :)
 
Too much information for today. Will get back tomorrow.
Good night and good afternoon for everyone
Thanks for your help
 
@PauloCereda linked in said so (but then it told half the world I'd been at NAG 4 years the other day, so I can't vouch for its accuracy)
 
@nagylzs See ya!
@DavidCarlisle oh.
 
 
2 hours later…
8:02 PM
Thank you, very...sexy. Works! I'll have a look into the other suggestions, too. But as usual: who has the time to actually learn Latex? It is the results what one wants, not the way to go there. — Bohlero 4 hours ago
Nobody called my solutions/workarounds sexy so far.
 
8:15 PM
@Johannes_B talking of people being lead astray by bad examples, who'd suggest \noindent to a beginner:-)
 
Hello everyone!
I would like to use a permutation notation like this one as inline math:
Theoretically this doesn't need to be taller than a fraction, which can be used as inline math just fine, without a large line spacing.
How can I use such a notation and make sure that it doesn't take too much vertical space?
\begin{array}... will take as much space as in display math.
Or perhaps this should be a main-site question instead of chat? @David?
OK, here it goes:
0
Q: Enter 2 by n matrix as inline math without taking up much space

SzabolcsI need to use something that looks like a 2 by n matrix as inline math. How can I achieve this without it pushing the lines apart? Example: \left(\begin{array}{cccc} 1 & 2 & \dots & N \\ i_1 & i_2 & \dots & i_N \end{array}\right) The problem with this code is that it takes as much space as...

Well, sorry about that. Let me know if I should delete it.
 
8:37 PM
@Szabolcs amsmath has smallmatrix env for this
@Szabolcs oh you found that already;-) (just self answer I think)
 
 
2 hours later…
10:13 PM
@Szabolcs Well, I really don't think that this needs be CW. Opinions, @Joseph?
 
@tohecz agreed
 
@JosephWright and tell me, about the , is there any way how to prevent bumping 96 questions?
 
@tohecz No
 
@JosephWright so should we do them only like dozen or two a day? Should I take care of some?
 
@tohecz Indeed, that's a reasonable plan
 
10:20 PM
@JosephWright ok, I'll do some now
btw, this question has five tags, all synonyms :D :P
28
Q: What are the possible dimensions / sizes / units LaTeX understands?

HenrikI know there are different ways of expressing sizes or dimensions in LaTeX such as points (pt), inches (in) and ex. As some commands, such as \hspace understand all of them, I would like to have a reference or complete list of possible dimensions or sizes including a description of what they mean.

 
10:34 PM
Down from 96 to 79, that's enough for today I think.
 
10:49 PM
@tohecz @JosephWright I don't particularly care if it's CW or not. Making it CW won't give me reputation for answer-upvotes, so it was a sort of protection. I was worried that some might think that I posted an extremely trivial self-answer just to get some rep. In reality I couldn't care less about reputation score ...
TeX.SE is pretty friendly though, I'll keep it in mind for the future
It's great that this site managed to stay so friendly despite its size.
Mathematica.SE is much smaller, but I feel that the general mood has been going downhill ... it's hard to tell why. I get annoyed by very basic questions sometimes, so I'm definitely guilty, but I also try to keep in mind what it's like to be a beginner. (In LaTeX I seem to be an eternal beginner which is not a good thing ...)
 
 
1 hour later…
11:57 PM
@Szabolcs Well, you haven't done anything wrong, and we have recognized thhat your question isn't bad, neither your answer is :)
 

« first day (1454 days earlier)      last day (3462 days later) »