2
votes
1answer
55 views

How to get float numbers as parameter of \newcommand

I have defined a \newcommand function like into this code: \documentclass{scrartcl} \usepackage{pbox,calc} \newcounter{pointsExo} \setcounter{pointsExo}{4} \newcounter{pointsSousTotal} ...
4
votes
1answer
64 views

Resize tikzfigure in tcolorbox depending on height of tcolorbox

in my book I got many different type of boxes so I made some macros placing the boxes automatically according to their arguments. That's one of them. So far I made some boxes that have big "+" and ...
5
votes
2answers
113 views

Delayed expression evaluation giving wrong result

I have made my own lists. I want to refer to them outside the lists. If I do a calculation using counters at a certain point in my list hierarchy, say \alph{listcounter}, how do I freeze that result ...
6
votes
1answer
235 views

dimexpr: multiplication with constant real factor from macro

I want to multiply a constant from a macro with a deimension using dimexpr. When using real numbers the decimal point and the decimal digits are typeset behind the result and the result is a ...
5
votes
1answer
162 views

How to preserve lenghts to use with \includegraphics scaling, when calculating them with pgf

This question is related to my earlier question here: How to define a macro that uses image width and height to define a variable for later use . There you can find a full MWE of the problematic code. ...
8
votes
1answer
195 views

How to define a macro that uses image width and height to define a variable for later use

Ok, the title might be a bit cryptic and my question is a bit lengthy, so please bear with me. What I want to do is: I have two images with different aspect ratios that I want to place next to each ...
5
votes
2answers
135 views

Floating Point multiplication in custom commands

I'd like to create a custom command which creates an underscore of a given length. However, this length should be the argument of the command multiplied be a floating point constant. How can I ...
4
votes
1answer
171 views

Manipulating arguments in newcommand

I'd like to manipulate the arguments in \newcommand. More explicitly, I'd like something like that: \newcommand{\X}[1]{ #1+1 } And if I call \X{0}, I want it to return 1 and not 0+1. Thank you :-) ...
4
votes
1answer
418 views

Prevent tikz to calculate

I just played with an answer to a question I asked here some time ago: Divide a rectangle into n times k equal cells. I wanted to be able to generate the list of points in a separate macro, however ...
9
votes
2answers
596 views

Calculating percentage

I have tried to use the calc package to write a macro which prints a percentage based on two numbers. E.g.: \printpercent{100}{200} should display 50% as 100 is the half-way point of 200. I have tried ...
15
votes
3answers
574 views

Using command to compute sum?

I must admit this sounds like an easy question. I'm creating a grading model for a homework assignment, and I'm adding the maximum amount of points to each question. Is there a way to have LaTeX ...
7
votes
3answers
352 views

Convert hour to decimal number

I'm trying to make a command for converting an hour (ex: "14:17") to a decimal value (hour + min/60 = 14.28333333333) for use in a TikZ schedule : \creneau[day=1, start=13.5, ...
17
votes
3answers
2k views

Doing maths with distance values in LaTeX source code

I have a sty file with the command \newcommand{\foo}[1]{\noindent\kern#1} but I'd actually like to have something like \newcommand{\foo}[1]{\noindent\kern{#1 *0.5}} meaning that I'd like to have ...
3
votes
3answers
2k views

Can LaTeX perform simple math operations? [duplicate]

Possible Duplicate: How can I automatically calculate sums in a LaTeX table? Can LaTeX do simple math? I have a table with two columns and want to automatically add a third column which ...
10
votes
2answers
5k views

Performing basic arithmetic in custom commands

One thing annoying in sparklines is its verbosity and dependence on external arithmetics. For example, to depict a three bar graph of 16%, 53%, 31%, one has to write: \begin{sparkline}{4} ...