1
vote
1answer
69 views

Effect of adding plus and minus to \includegraphics

I have a document with a lot of pictures. The exact scale of the pictures isn't all that important. Is it possible to allow the pictures a little bit of "stretch" to help squeeze everything together? ...
4
votes
2answers
99 views

How to calculate a new length?

What I want to do is calculate the actual size between the edge of the paper, and my header. \evenmarginsize and \oddmarginsize do not do this. \settowidth{\msize}{((\paperwidth - \textwidth)/2)} ...
5
votes
1answer
160 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. ...
10
votes
3answers
248 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
77 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
1k 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
127 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
3k 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
297 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
741 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
584 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 ...
9
votes
2answers
1k 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
208 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} ...
40
votes
3answers
10k 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
858 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
1k 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} ...
13
votes
3answers
2k 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}{ ...