# Tag Info

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 { ...

2

1

The \real macro seems to need arithmetics desperately, i.e. use 1*\real{19.95} etc. But it will be truncated anyway! \documentclass{article} \usepackage{siunitx} \usepackage{numprint} \usepackage{calc} \newcounter{foo} \begin{document} \addtocounter{foo}{5*\real{1.7}} \thefoo \end{document} Related: Is there a counter or variable that can be used ...

2

Oooo this is ugly... \documentclass[tikz,border=5]{standalone} \def\atchar{@} \tikzset{set color/.style 2 args={.. set color={#2!@!@;0;;#1;}}, .. set color/.code args={#1!#2;#3;#4;#5;}{ \def\tmp{#1}\ifx\tmp\atchar% \tikzset{#5=#4}% \else% \ifcase#3\relax \tikzset{.. set color/.expanded={#2;1;#1;#5;}}% \or ...

1

An easy and intuitive solution is to use the package calculator. It enables variables handling (definition, use and calculation) easily and without needing LuaTeX, nor eTeX. To affect a value to a variable, you use \COPY{<value>}{\myVariable} (yes, it's upper case). You can then print/use your variable value as simply as \myVariable. To do some ...

2

This is a side effect of the tabulary package. In this package, tables are evaluated twice, to ensure right widths in columns. In your example, sums are increased by 43 (the last value ontained in the first evaluation!). Modify your code to ensure that \mySum is zero when the second calculation occurs: \begin{document} \begin{minipage}{.25\textwidth} ...

2

Almost all commands defined by calculator have local behavior (his scope is restricted into groups). This is the reason because \ratioTwo is undefined when you change to another column in your tabularx environment. Use the \GLOBALCOPY command to globalize your number: \GLOBALCOPY{\ratioTwo}{\ratioTwo} (note than you can assign the same name to the new ...

1

Here's a solution with a wrapper for the \DIVIDE command, defining a \ratio#3 command, where #3 is the 3rd argument, say Two etc. It's a global command then, however, but survives the tabular cell. Using a toks register could be an alternative. \documentclass{scrartcl} \usepackage{calculator} \usepackage{tabularx} \newcommand{\newratio}[3]{% ...

3

You can use the xticklabel cs to position the x axis label: every axis x label/.style={at={(xticklabel cs:1)},anchor=south,red}, typeset ticklabels with strut, xlabel={$t$\strut}, The \strut inside xlabel and option typeset ticklabels with strut are used to ensure that the ticklabels and the label have the same height and the same depth. Code: ...

0

I am not sure if \xcoord and \ycoord will always be pure numbers. If they are you can use this: edit: ah sorry, naturally you can have decimal numbers as coordinates. Well, assuming then that \xcoord and \ycoord are always unitless: \documentclass[tikz, border=.2cm]{standalone} \begin{document} \begin{tikzpicture} \draw[->] (-3,0) --(3,0); ...

4

with atan2 (atan 2 (wikipédia) \documentclass{minimal} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \draw[->] (-3,0) --(3,0); \draw[->] (0,-3) -- (0,3); \foreach \xCoor/\yCoor in{3/3,3/-3,-3/-3,-3/3}{ \pgfmathsetmacro{\angleValue}{ atan2( \yCoor,\xCoor ) } \draw (0,0) -- (\xCoor,\yCoor)node[right]{\angleValue}; } ...

Top 50 recent answers are included