3
votes
1answer
52 views

Conditional structure based on \rand value comparison

I have a simple code that inserts a complex layout for figures and I would like to randomly alternate the position options (for instance, alternating between top and bottom positioning: ...
13
votes
3answers
320 views

How to compare numbers with decimal point and logical OR operation?

I'm reading five values from external CSV file as [\sone, \stwo, \sthree, \sfour, \sfive]. Sample values could be [55.3, 89.0, 33.5, 40, 0.10]. Question : How to compare number with decimal points. ...
9
votes
1answer
897 views

Handling \ifnum's “! Missing number, treated as zero.”

Let's say I have a variable, which may - or may NOT - be a number; how can I handle the cases when it isn't a number, without crashing with "! Missing number, treated as zero." ? In practical terms, ...
3
votes
1answer
219 views

How to compare two dates using TeX primitives

This is a follow up to TeX capacity exceeded while parsing a date string I want to compare two dates, say today's date and a due date. I have the due date information stored (as number strings) in ...
7
votes
2answers
1k views

LaTeX: Use command argument in conditional?

I'm in the process of writing a command that outputs a certain text only if its argument is a nonzero number. I'd like to be able to write something like: \newcommand{mycommand}[1]{ \if{#1 != 0} Some ...
4
votes
2answers
676 views

Compare a character to a character code?

How can one compare a character (e.g. "U") with a character code in a certain font (e.g. "\char85"). I'd expect the following to work: \documentclass{article} \usepackage{ifthen} \begin{document} ...