Tagged Questions
2
votes
0answers
82 views
What is the most convenient way to do general-arithmetic calculations involving lengths?
I know LaTeX can store at least two types of numbers: Dimensionless quantities (i.e. 1, pi, etc.) and lengths (i.e. 1pt, \textwidth, etc.). Is there some convenient, general way to do calculations, ...
2
votes
1answer
43 views
Store a ratio value in command and then use it to recalculate a length?
I want to store a ratio value in a command, e.g. \newcommand{\ratio}{0.7}, and then use it in recalculating a length, e.g. \setlength{\somelength}{\ratio*\width}.
Using lengths to store the ratio ...
2
votes
1answer
611 views
\dimexpr \numexpr & calc package
Why doesn't this work? I use Windows, TeX Live 2012 and pdfLaTeX
\documentclass{article}
\usepackage{calc}
\newlength{\perclenght}
\setlength{\perclenght}{%
\dimexpr%
...
5
votes
2answers
97 views
Can you add a constant value to a length macro?
I have a box that's the full width of the page. I would like to offset it back into the margin a little, but when I do that it no longer reaches the edge of the page. Is it possible to keep using a ...
11
votes
2answers
1k views
How to use \widthof as parameter to \kern
I sometimes encounter a problem when I attempt to use \widthof from the calc package, and don't know why. In the past I have just worked around it using a two step process of defining a \newdimen{} ...
8
votes
1answer
214 views
calc package incompatible with \setlength in \g@addto@macro?
I want to systematically have some indentation in \parboxes and minipage environments. To do this, I add the following code in the preambule of my LaTeX file:
\makeatletter
...
3
votes
1answer
512 views
Multiplying a length by a factor
I am trying to create a package that will use grid typesetting (in the humanities, so not much of a problem) but that should allow the user to freely set the \baselinestretch. I am using the memoir ...
5
votes
2answers
324 views
Add two lengths in raisebox argument, without the calc package
I've seen people use such constructs as \raisebox{-\height+\baselineskip}{...}, which works well using the calcpackage.
What equivalent would you use to achieve the same behaviour without the calc ...
8
votes
2answers
679 views
How to enable use of minus and plus in tex documents?
I see many cls files using plus and minus operators to set lengths. How can I use these operators (or some equivalent macro(s)) to do something like the following?
\setlength{\lengtha}{.5\textwidth}
...
0
votes
1answer
169 views
How should I express my length calculation to minimize rounding errors?
I have an input file as follows.
% Test.tex
\documentclass{article}
\usepackage{pstricks}
\psset
{
linewidth=0.01
}
\newcommand\All{0.1}
\newcommand\Left{-\All}
\newcommand\Right{\All}
...
26
votes
3answers
5k views
Get width of a given text as length
Is there a TeX command that returns the width of a given text as length value, so that I can use the result directly as a length argument of another command?
I mean, I would like to have a command ...
12
votes
2answers
591 views
Where is the left-hand margin?
I'm working on the TikZ-from-TeX-SX package, specifically developing the code for putting equation numbering at places within a tikzpicture environment. To do this, I need to know where the text ...
3
votes
2answers
731 views
Calculate maximum of lengths
How can I calculate a maximum of lengths? I am aware of pgfmath's function max(x_1,x_2,...)
\documentclass[a4paper,draft]{article}
\usepackage{tikz}
\pgfmathparse{max(3,4)}
\begin{document}
...
12
votes
3answers
1k views
Why doesn't \settoheight of \parbox work?
Consider the following code:
\documentclass[a4paper]{letter}
\usepackage{calc}
\usepackage{printlen}
\newsavebox{\foobox}
\newlength{\fooboxheight}
\savebox{\foobox}{
...