@Mohan yes but 13 is two tokens (and needs a third say a space to stop the number) that ='s three bytes \char"D saves a bit of time and a bit of space.
@Szabolcs Ive not really looked at mylatexformat but it was mentioned in a couple of answers and its top level description says it updates and extends my original which is quite believable
@David Are the instructions here complete? I have a tex file, tst.tex, as bare as possible, just \documentclass{article} \begin{document} boo \end{document}. Running latex -ini mylatex.ltx tst.tex gives an error.
I really have to read about LaTeX beyond basic formatting ... after years of use I'm still a complete novice
Thank you @David, got it working. This was the last piece to solve the problem I asked about. You could have made that an answer. I'll write an answer when I get it fully working.
@FaheemMitha I think for a journal, publishing bad typography is a crime. If a publication gets "key paper" status (like, say, the Gödel papers), thousands of people will make copies of this same article for hundreds of years. So getting it typographically perfect really pays off.
:7187407 Close (India leading by 32)
India won the toss and decided to bat
India 1st Innings
316 all out (105.0 overs)
India 2nd Innings
239 for 9 (83.0 overs)
England 1st Innings
523 all out (167.3 overs)
@JosephWright Wow! I nailed it! But I'm sure there's some hidden trick by which India can overcome the trouble (I guess that 100 runs are not a big problem starting from no out, while they are with nine out).
Hi all! I just submitted my first package to CTAN, but you can already find it at latex-concepts.googlecode.com. I'm eager to receive feedback, if you can spare some time. :-)
@egreg yes but as Joseph hinted, the factor that comes into play now is the time, there is one day left which should be plenty of time especially in India, if playing in England there's always the hope (for the losing side) that it rains al day and so they survive to the end then it is a drawn match.
last time I've asked for sources to learn how to program in TeX/LaTeX, one of the recommended references was TeX By Topic. But that is pure TeX. What about LaTeX? What should I know in order to be write (in the right way) a package or class?
@leo you need the texbook or TBT to get a good understanding of the tex programming language, for latex there is the latex companion for a high level view, or the latex sources (source2e for the format, or any package source) to see how to write a package. there is also clsguide.tex in the base distribution
@leo csname is a tex primitive, it is described in texbook or TBT there are examples of its use all over the place in the latex sources, so it depends what about it that you want to understand
I'm also still using etoolbox and friends. But I've read about expl3 (= LaTeX3, sort of). If you first see the style, you'll be confused. But it's quite well-structured and useful.
Reprogramming my package in expl3 is future work for me.
If you're a beginner, I guess you might as well start with expl3 right away.
@leo there are several patch command versions on ctan apart from etoolbox, or egreg has a patch command based bruno's regex stuff, but I find it's usually simpler just to modify the command using tex primitives you don't really need a package for that
@JosephWright Hm... That's debatable. When writing a package with a simple purpose, you can't possibly anticipate how other people will want to use it.
@JosephWright but we can patch to have another thing that does something similar to the original one plus something more. Perhaps we want to keep the original
@JosephWright For example, you may want to track what your 'deepest' document level is (chapter, section, etc.) How can you do that without patching some basic LaTeX commands?
@JosephWright Of course I agree with you in principle. But things will never have a perfect design. Also, what you're now calling perfect will be found lacking in the future. You need to allow people to hack a bit (at their own risk).
@JosephWright Then put the 'wrong but useful' stuff in a module called 'wrong-but-useful'. Still, it should be there, to compensate for the bad design choices of others.
@mhelvens Patching arbitrary commands is tricky, which is why @egreg's regex-based code is probably the most flexible method (at the cost of some complexity)
@JosephWright I haven't seen @egreg's code, but any complexity can be encapsulated to provide a simple interface for common tasks. Like appending code to an existing macro'.
what I want to do is for example you have list-by-topic of exercises say limits, continuity, derivation. I want something that takes n random continuity exercises, m random limits exercise and k random derivation exercises and puts all together in an exam
I want to keep track of the dates of the exams, to avoid put the exercise of the past period in the same exam
@leo You can do that, although it depends a bit on the scale of your lists, some would argue that it's better to have such things in a database and do the randomisation and assembly elsewhere and just let TeX worry about the typesetting (wouldn't they @StephanLehmke ?)
@mhelvens It would have been much better if Philipp Lehman did not disappear. He was (unfortunately not is but was as we are coming to accept that) indispensable for many important contributions.
@DavidCarlisle Certainly. For a couple hundred exercises a TeX-based approach is surely sufficielnt. For a couple thousand exercises or any advanced selection or bookkeeping requirements, a database is better.
@DavidCarlisle I'm thinking in do this using the exercise package. My approach is: the list must be a separe .tex. There must be an exercise environment to tag the exercise and so that you can count the exercise and assign to them a number. The count will be performed during the compilation. The randomization can be done with some pgf stuff. For sure is not the better approach, but TeX is able to all this things and I can image how to write something to do them.
That's because I want to learn more, to see what is the better approach
@leo You can keep your exercises in a csv or dat file. pgfplotstable is capable of dealing with numbers up to a couple of thousands and that seems sufficient. So querying some random exercises from the dat file and typesetting them via examp class can be separated like that.
@leo sure there are lots of things people write in TeX for those reasons. Some people even write xml parsers even though Tex isn't the best language for that either.
@leo Actually, I find LaTeX's lack of good programming facilities a bit frustrating at times. Having to spend days to get some code working that I can write in C++ in half an hour.
@leo Found it. According to Harish Kumar this one tex.stackexchange.com/questions/64864/… works with a couple of hundred entries on each table. So it shouldn't be a problem to fetch questions in the same manner.
@StephanLehmke I named you originally but couldn't remember the context in which you'd admitted your sins so I thought I'd better anonymise the reference:-)
@percusse: Beforehand, I must introduce a Brazilian style of music named pagode, which originated in Salvador, Brazil, and quickly went down to Rio de Janeiro region, as a subgenre of Samba. Personally, I don't like, but there was a fever of this style here a few years ago.
@percusse: that said, there's a famous story about a group of four or five engineers that were still coursing Algebra, Calculus, etc, and were very frustrated.
Since they were not satisfied with the course, they decided to drop the whole thing and start a pagode band. The name of the band is quite curious.
The name of the band was Inimigos da HP, which can be translated to HP enemies. The HP part is a reference to Hewlett Packard, possibly the brand of their calculators. :)
This is almost duplicate to question Random unwanted space between paragraphs but I don't even use \par.
I'm using pdflatex to compile a .tex file. As I wrote my text I noticed a sudden change in how the paragraphs of my document were spaced. From being just indented there appeared a huge gap be...
In other news, I once was using my netbook in a bus travel and noticed that a lot of smartphones from random passengers were acessible to me via Bluetooth. I was tempted to send a pic of a lolcat to each smartphone. :)
@egreg It's generally the case with those questions and that's anyone's first frustration with looking up a symbol no? I found these two just by searching quarter
And you can combine them so if we answer this one then many others should be repoened too.
@mhelvens I don't think it's that bad, especially if you can combine it with a dedicated language to do input preprocessing. The main drawbacks of TeX are the impossibility to realise some data structures efficiently and the difficulties in finding errors. The latter will always haunt you, but because of no bloat in the base engine since the 1980s, if you can defer really complicated data crunching to the preprocessing stage, the former won't be much of a problem.
@StephanLehmke Okay, maybe not that bad. ;-) But let's face it, (La)TeX is a domain specific language. The only reason people are trying to program in it, is that they can't be sure their users have any specific tools except LaTeX itself. Of course, it's still amazing how much can be accomplished with a paperclip and a pack of gum.
There are some areas (like data based publishing) where there is almost no alternative to (La)TeX programming, as there are areas where there is no alternative to Java. I don't know much about Java, but from what I DO know, I rather program (La)TeX, so I pulled the longer straw after all ;-)
@egreg Ah, I wish I can access them without paying extra 5 euros a package. I'm grinding my own usually but the machine is broken boyend repair. (A gravitational accident) so temporarily I can't use grains.
@mhelvens How are you imagining the interaction between the "other" tool and LaTeX? LaTeX calling the other tool or the other way round? Sounds unrealistic for most LaTeX packages even if there was such a tool.
@mhelvens That's not "another tool" you're talking about, but a complete redesign of the TeX engine. A lot of people have tried that before, and all these approaches have stalled long before getting to a productive stage. LuaTeX seems to be making it indeed, and I'm certainly investigating that in detail in the near future. But it's still not paradise. You can do a lot in Lua, but it has its limitations.
@PauloCereda Well I'm working together with like 70 guys who think the same ;-)
But most of them never learned another language, and whenever there is an internal talk about some groundbreaking tool like Maven or Spring I can't help thinking that Java is trying hard to solve all the problems we wouldn't have without it...
@mhelvens You're on your way to becoming Jonathan Fine all right ;-)
@StephanLehmke Every new language claims Fortran is grandpa stuff but yet to reach is numerical consistency. I guess currently only Python based tools with SciPy and other stuff that can access LaPack can fly
@PauloCereda I'm not so sure about that. My traumatic experience was a student group taking the better part of a year to write a formula parser in Java which would have taken a couple of minutes in PROLOG with definite clause grammars...
You know, since David is the person around here with the more witty comments, we could create a badge named carlislian (Star Wars anyone?) which is: have David star one of your comments. :)
@StephanLehmke Some problems are better on some paradigms. Logic has a very broad application, but sadly a few people know how to use.
@PauloCereda In semidefinite programming violation of constraints by 1e-8 is important. You can't just say ah that's almost feasible the implications can be terrible. But in Matlab it's sometimes even infeasible when it says it's feasible. Hence fun with Java based tools.
Also one of my favorites : addition/subtraction of a scalar and a matrix goes silently OK. 1 - rand(5,4) does not give any warning or error just assumes a matrix with all entries 1.
Hi all, I'm looking for something TeXy. I could do the research and write an official 'question', but perhaps one of you just has the answer ready.
In my package documention I frequently typeset some LaTeX code, then immediately run it and display the output for demonstration purposes. Is there a way to get both 'versions' of the code ('verbatim' and 'real') from the same source? I don't like duplicating stuff.
@JosephWright I once witnessed a talk by him presenting something like a perpetual TeX engine which would run in an event loop, with some user interface much like what @mhelvensseems to imagine. Only dvi though, because you can generate that in chunks.
@JosephWright The trick here seems to be to output the code to a file first with filecontents. And I think the rest of that package is about nicely printing it side by side.
@JosephWright I do think I heard about some commotion in UK-TUG in which he took part, but I don't know any details (not even "who against whom" or when).
Hi again! I just need one more insight to make my code-example code nicer. It's a problem I've run into on more than one occasion. I'd like to embed a verbatim-like environment (filecontents, in this case) into my own environment. But if I do that the correct terminating string is no longer used literally, and the scanner runs into the end of the file. Is there a trick to fix this?
A trick to change the terminating string that the environment is looking for, essentially.
@Mohan Aha. Yes, to be honest I didn't pay particular attention to your discussion before. ;-) Thanks!
@Mohan Hmz... It just happens that none of those solutions will work for me, since I'd like to have the content between my own environment delimiters to be considered verbatim. Also, they assume I want to typeset something verbatim, but I really want to give it as input to another command that parses verbatim stuff. Tricky...
I could take filecontents.sty and change it to work for me. But I'd rather use a simple fix or patch.
Sometimes you have to run bibtex a few times for citations to "catch", some times latex or pdftex must be run a couple of times to get all references fixed, etc. Is there a consistent summary somewhere stating in what situations one has to run these programs more than one time? Or am I stupid and each really needs to run only once?
@HenningKlevjer If you add new citations, a run of bibtex after the latex run is needed. Then other two latex runs` for syncing the cross references. However, during document preparation I usually don't bother too much with correctness of cross references.
@HenningKlevjer First LaTeX run uses \cite information to write to .aux file. BibTeX reads .aux file, finds citations in .bib file and writes a .bbl. Second LaTeX run uses .bbl as bibliography, third LaTeX run deals with numerical cross-references
@HenningKlevjer When LaTeX runs, it takes note of what citations you make; BibTeX reads the notes, and compares them to the bib database, extracting the data and preparing the bibliography; at the next run LaTeX can know the order of the references, so at the next it will assign the correct numbers to the citations.
@JosephWright it's microsoft's take on OCaml which is an object oriented version of caml which is a french version of SML which is the standardised version of ML which was the meta language for a theorem prover once. Banks mess up your pensions with it.
@PauloCereda Think lambda calculus (so language purists take notice) with added hooks to access the full .NET system libraries (so you can get stuff done:-)
In the spirit of the festive season and How can we draw a Christmas tree with decorations, using TikZ?, I would like to use TikZ for drawing a Hannukah Menorah. There are many different styles of Menorah including
and
amongst others. Of course only the most greedy person would also ask for ...
@Mohan well it is the character control-M ie character13, which TeX normally puts at the end of each line, by making it active and giving it a definition you can make the end of line in the source have arbitrary affects on the processing
@Mohan egreg used ! just as an available unused character it's a standard trick when you need to refer to a character in its normal and active form, you write it using two different characters but use lowercase to convert one to the other so although that says \def! in the source it has been "lowercased" to \def^^M
@Mohan well actually you may need to fiddle with it as \\ at the end of a para would cause a spurious line.
@Mohan but basically you can make it anythimg,. best might be to leave it as par as egreg did but set parskip to 0pt rather than the baselineskip I used
by the way, what you said above about lccode has been incredibly helpful -- I think that's exactly the kind of thing that makes a lot of macros inscrutable to people at my level.
@Mohan no lowercase simply does a pass over all the tokens without expanding or executing anything but replaces every character with a non zero lccode by the character with the specified code, then TeX starts again at the start of teh expression evaluating the transformed token list.
@Mohan lets see how it goes, although you should probably let @JosephWright make it a community wiki (which means as it's a kind of general question the rep count is not associated with the question or answer, and people can be encouraged to make multiple answers or edit existing ones)