Skip to main content
102 votes
Accepted

When is TeX better than LaTeX?

TeX is useful when you want to fully understand what's going on, or want to have full control. In principle this is possible with LaTeX too, but there's a lot more to understand. (That is, LaTeX is ...
ShreevatsaR's user avatar
  • 45.5k
43 votes
Accepted

minted vs. listings: pros and cons

This is really further commentary on samcarter's answer. minted uses an external library to do the highlighting, listings does everything in TeX. Almost all the pros and cons are attributable to this ...
David Carlisle's user avatar
38 votes
Accepted

Decide between Polyglossia and Babel for LuaLaTeX in 2019

Here's some reasons why I prefer babel over polyglossia for LuaLaTeX. babel's base is part of the LaTeX core packages actively developed, but polyglossia is only getting a few minor updates. babel's ...
David Purton's user avatar
  • 25.9k
32 votes

When is TeX better than LaTeX?

The question has no answer, actually it meets the standard "opinion based" close reason. but I'll attempt an answer anyway. TeX is a macro expansion language, and LaTeX is defined as a set of macros,...
David Carlisle's user avatar
24 votes

Decide between Polyglossia and Babel for LuaLaTeX in 2019

There are 79 language definition files (gloss-XX) in the polyglossia folder. For a thorough comparison you would have to compare for every language how good the gloss-file is, if it works with ...
Ulrike Fischer's user avatar
22 votes

minted vs. listings: pros and cons

(Disclaimer: I am a listings user, so maybe my opinion is biased) As far as I know minted needs to be run with -shell-escape. This can be a con in several situations: the tex system is set up to not ...
samcarter_is_at_topanswers.xyz's user avatar
15 votes
Accepted

What is the difference between ~ (tilde) and \, (backslash comma) for a nonbreaking space?

The difference between a normal unbreakable space and a thin unbreakable space: \, is 1/6em, while ~ is, if I'm not mistaken, what TeX denotes \fontdimen2, the interword space.
Bernard's user avatar
  • 272k
11 votes

How can I check if the value of a variable is the same as what another variable?

Well your question is not simple. At first you didn't explain what you mean by "same for you" so the rules for your "fuzzy" comparision are quite unclear. And at second you didn't explain what content ...
Ulrike Fischer's user avatar
10 votes
Accepted

Checking if an integer is a member of an integer list

You can use do a comma-separated list parser to loop through the list of items and check if the given item is present in the list. Since the comma-separated list can be read by using a delimited macro,...
Phelype Oleinik's user avatar
10 votes
Accepted

Expandable case insensitive switch case for string comparison

With the kind help of expl3, this is expandable (if the code of the cases is, so with the normal definition of \selectlanguage it isn't). EDIT: as pointed out by @JosephWright, \str_foldcase:e is to ...
Skillmon's user avatar
  • 60.8k
9 votes

check that two tex sources generate the same pdf

In the spirit of "holding the paper up to the light", we can replicate exactly this effect with a Python script. Read the PDF, the overlay the pages to find out whether each pixel is the same. import ...
Aaron Stockdill's user avatar
9 votes

Looking for characters within a string

You can test each item in the first string for being in the second string; at any “non match” stop and return false. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\...
egreg's user avatar
  • 1.1m
7 votes
Accepted

Why can't I compare a string read from a file with a predefined one?

NO ADDITIONAL PACKAGES Change the \catcode of \endlinechar (from 5-end-of-line to 9-ignore) and do a \read instead of \readline. \documentclass{article} \usepackage{filecontents} \begin{filecontents*...
Steven B. Segletes's user avatar
7 votes

When is TeX better than LaTeX?

A few years ago I threw some effort into learning plain TeX. I did this because: I find LaTeX output ugly I was learning ConTeXt, and its documentation often suggests you drop down to plain TeX when ...
Daniel Lyons's user avatar
  • 2,031
7 votes
Accepted

Find the highest year in a string

The year is extracted with the regular expression [0-9]{4}. With \regex_extract_all:nnN all matches are stored in the sequence \l__Skay_dates_seq. This sequence is used with \seq_use:Nn and a , ...
matexmatics's user avatar
  • 4,999
6 votes
Accepted

Class: Definition of an empty variable: etoolbox: problems of comparison

\global\def\prez% \DeclareOption{prezE} defines \prez so it has to be followed by \DeclareOption and expands to prezE I guess you intended \global\def\prez{}% \DeclareOption{prezE} to define \prez ...
David Carlisle's user avatar
5 votes
Accepted

How can I check if the value of a variable is the same as what another variable?

A (weaker) version of Ulrike's code that works also in TeX Live 2013; the assumption is that < and > don't appear in the strings you want to compare. \documentclass{article} \makeatletter \...
egreg's user avatar
  • 1.1m
5 votes

When is TeX better than LaTeX?

I'm a long time LaTeX user (I found it difficult to understand the TeXbook) but I'm approaching this from a computer programming viewpoint. My first introduction to programming was a course at the ...
Peter Wilson's user avatar
  • 28.1k
5 votes
Accepted

Detection if image path contains string fails

expandafter\detokenize{ expands a { which is not expandable, you intended \detokenize\expandafter{ to expand the token after {
David Carlisle's user avatar
5 votes
Accepted

Expl3 equivalent to greater than

you want \int_compare... functions eg \int_compare:nNnTF {3} > {4} {yes} {no}
David Carlisle's user avatar
4 votes

Conditional test inside command parameter

the requested syntax seems very odd, but width= and scale= are just variants of scaling with width implying scaling the natural width so you just need the following which avoids duplicating \...
David Carlisle's user avatar
4 votes
Accepted

Conditional test inside command parameter

It makes very little sense requiring something like width=1.2\textwidth: if the first item is bigger than 1, the image would be scaled to be wider than the text width. And mixing scale and width is ...
egreg's user avatar
  • 1.1m
4 votes

Define an expandable function for comparing a token list to a string in LaTeX3

You can use the etl package. It can expandably compare token lists. It has a few limits though: it ignores the character code of group begin and group end tokens (normally { and }, but one could also ...
Skillmon's user avatar
  • 60.8k
4 votes

check that two tex sources generate the same pdf

You can use \tracingoutput to get information about the boxes that LaTeX ships out to the pdf. This should allow you to identify differences that would fail your test of "if you put them one on top of ...
StrongBad's user avatar
  • 20.5k

Only top scored, non community-wiki answers of a minimum length are eligible