New answers tagged

2

Something like this? \the\numexpr\year-1983 will calculate the difference between the current year (as long as the \year register has not been screwed up) and the year 1983 and print the result. \documentclass{article} \def\yearofbirth{1983} \begin{document} Foo is \the\numexpr\year-\yearofbirth\ year(s) old \end{document} Here's a more convenient ...


5

The exam class could be helpful here, especially if you don't always want the parts to have the same point value. The appearance of points and format of questions is quite customizable, and it keeps track of the points for you. \documentclass[addpoints]{exam} \begin{document} \qformat{Puzzle \thequestion:\ (\totalpoints\ points)\hfill} \begin{questions} ...


7

You need a form of \ref that is, in LaTeX parlance, "expandable". The refcount package offers the macro \getrefnumber{<label>} to do this. This approach may require 2 compiler passes. \documentclass{article} \usepackage{refcount} \usepackage{calculator} \begin{document} \MULTIPLY{3}{\getrefnumber{last}}{\mypoints} \section{Puzzle 1 ...


0

I solved the problem with some extra macros for veclen. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \makeatletter \def\veclen#1=#2->#3;{% \edef\x{\noexpand\@veclen\noexpand#1#2#3}% \x } \def\@veclen#1(#2,#3)(#4,#5){% \pgfmathsetmacro#1{veclen(#2-#4,#3-#5)}% } \makeatother \begin{document} \begin{tikzpicture}[scale=0.5] ...


2

You can use \ifnum and \ifdim like this : \documentclass[tikz,border=7mm]{standalone} \usetikzlibrary{calc} \begin{document} \newcommand{\centers}{(0,1),(0,0),(5,3),(2,1),(0.5,1),(4,3),(0,5),(1.6,3.5),(6,0.5)} \begin{tikzpicture} % link centers if circles intersect \foreach[count=\i] \a in \centers { \foreach[count=\j] \b in \centers { ...



Top 50 recent answers are included