Linked Questions

32
votes
6answers
4k views

Testing for number

How do I test if a given parameter is a number, in order to apply a different style? And if not, just ignore... Like: \domorestuffifnumber{things} -> things \domorestuffifnumber{123} -> \...
13
votes
4answers
979 views

Checking for valid floating point number

I want to do the following: I am generating a report which can be set to be in imperial or metric units. All values are originally in metric units, so in the case of imperial units all values should ...
5
votes
3answers
518 views

xstring test for numbers within a range

I'm working on a document command that has a variety of optional arguments for different results. I need to add an option that yields 'true' for an optional argument within a range of numbers, for ...
3
votes
3answers
299 views

Check macro argument has correct format

I have a macro which will read in arguments in date format e.g. {2012-11-08} \usepackage{datetime} \def\customdate#1#2#3#4-#5-#6\relax{% \shortmonthname[#5] '#3#4% } However, in some instances I ...
3
votes
3answers
387 views

Latex: how to get question number in exam package

I am using exam package and I would like to add an extension to some solution in the form of a footnote with the same number of the question, as in \documentclass[12pt, answers]{exam} \renewcommand{\...
7
votes
1answer
528 views

How to add a \global before \pgfmathsetmacro?

It seems that one can't add \global before a \pgfmathsetmacro as that yields: You can't use a prefix with `\begingroup'. But that is the functionality I need here. I am trying to compute the ...
3
votes
4answers
207 views

Is there a shortcut to draw 30 degree bond angle increments in ChemFig?

I really like the facility in ChemFig to choose the bond angle in 45 degree increments by specifying an integer, instead of the angle directly: \chemfig{-[1]}. Right now, I'm drawing a bunch of ...
5
votes
2answers
65 views

Checking if argument is a floating point without breaking on control sequences in argument

Inspired by this answer to test whether an argument is a positive integer, I would like to extend this to floating point numbers. I want to have a macro \TestNumber that checks, whether its first ...
4
votes
3answers
204 views

Testing if a token list can be assigned to a \dimendef'd quantity

Given an arbitrary token list (say 01abpt), how does one check that it can be assigned to a dimension (say \@tempdima)? LaTeX \@defaultunits wasn't made for this type of test. If the token list is of ...
1
vote
1answer
41 views

Different text on last page

I want to add one of two different texts, depending on whether it appears on the last page. I tried this: \documentclass{article} \usepackage[angle=0, opacity=1, scale=1,position={0,0}]{background} \...