{lengths} is for questions dealing with measurements in TeX. If your question is about the spacing between document elements, use {spacing} instead.

learn more… | top users | synonyms

7
votes
3answers
323 views

Vertically center image with text midpoint

I want to vertically align the center of an image with the vertical center of the text on the same line using \raisebox. Using a macro is a must since it will be used many times (and multiple times on ...
7
votes
1answer
138 views

Decrease length of underscore character in normal text (gender_gap)

I use the underscore character _ in normal text mode (not typewriter). However, it is quite long. How can I decrease its length so that it is shorter? I followed the Tex FAQ on how to typeset an ...
10
votes
4answers
266 views

why can't \the be expanded?

\documentclass{article} \begin{document} \tracingmacros=2 \newlength{\len} \setlength{\len}{1cm} we want to write out \verb$\len$ in cm \the\len { oops, answer in pt} \setlength{\len}{0.0352\len} ...
25
votes
1answer
392 views

Using elastic lengths — when do they work?

I was wondering why elastic lengths like \fill seem to work only under certain conditions. For instance if I write A \hspace{\fill} B I get A left aligned, B right aligned as wanted. If however ...
3
votes
1answer
116 views

Limitations associated with getting length as number

I am representing actual object dimensions with scaled down graphics which capture the relative proportions of the objects (for instance, imagine a simple set of three or four line segments). I would ...
8
votes
3answers
188 views

Defining a Length that Scales with Fontsize Changes

I noticed a behavior regarding lengths under fonstsize changes, which I'm hoping there is a way to circumvent. Consider this MWE: \documentclass{article} \begin{document} \newlength\mylength ...
15
votes
3answers
268 views

How to print a length accurately and with user-controlled rounding?

Tried the printlen package, but it seems to not understand what 2.5in means: \documentclass{minimal} \usepackage{printlen} \uselengthunit{in} \begin{document} \newlength{\advertwidth} ...
5
votes
1answer
254 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. ...
9
votes
1answer
1k views

Get current font size as length

I understand from THIS question that the current font size can be determined. But how can I convert this to a length value? \documentclass[10pt,a4paper]{article} \newlength{\mytextsize} %This ...
4
votes
3answers
201 views

angled lines of unkown length in TikZ

I am trying to create angled lines from a point to specific border. Here is a minimal example: \documentclass[margin=2mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} ...
9
votes
1answer
93 views

Test if a skip has an infinite stretch/shrink component

I want to implement an if-then-else depending on whether a skip contains a special character or not. So far, I tried the idea: convert the skip to a token list, and check if the letter f is in the ...
6
votes
1answer
142 views

How to set lengths only for a specific environment (parindent for paracol in this case)?

Is it possible to set a length specifically for an environment? I know it is possible to change lengths for parts of the document only, by placing the \setlength command between {}, but when using an ...
10
votes
3answers
288 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, ...
4
votes
1answer
160 views

How to know the line width of enumeration in two column document prior to entering the enumeration?

I want to populate the following lengths just once prior to entering the enumeration (or perhaps prior to entering the document environment) to free me from worrying whether or not the ...
5
votes
2answers
354 views

How to use \textwidth (or any variable) in a picture environment

I don't understand why this doesn't work. I am getting a compile error. Am I missing something? \documentclass[12pt,a4paper]{article} \begin{document} \begin{picture}(0,0) ...
6
votes
1answer
25k views

LaTeX split long table in multiple pages and resize the width

I am trying to find a way to fix the width of my table to the margin of a portrait page (not landscape) while continuing the table in another page since it is very long. I can adjust the width by ...
1
vote
1answer
392 views

How can one produce spaces of arbitrary (fixed or relative) width that (do or don't) linebreak?

Adobe InDesign lets me insert a wide variety of spaces: over half a dozen spaces that allow for a line break (let's assume for the purpose of this question that they disappear in case of a line ...
5
votes
1answer
938 views

algorithm2e and \algomargin with negative value

How can I use a negative length in \algomargin using algorithm2e? I get the unpleasant effect that the vertical lines and the caption are not moved accordingly, see for example: Note that this ...
2
votes
1answer
80 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 ...
9
votes
2answers
262 views

Compute remaining horizontal space in align environment

I use align* often and sometimes it is preferable to add text to the right hand side of an equation instead of using \intertext, or \shortintertext, which tends to interrupt the math flow. This is ...
7
votes
4answers
346 views

Function determining the length of text, usable where something with internal units (e.g. “em”) is expected

Is there a way to define a function \horizontallengthof returning the length of a piece of text in internal units? I would like to be able to use it anywhere where something of that sort is required, ...
4
votes
1answer
127 views

How can I compare the width of a paragraph to 45% of the linewidth?

Here's my pseudo latex code to try and show what I'm trying to do in my memo latex class: \newcommand\headername{%should be the @memoto, or if too long, an abbreviated subject ...
8
votes
2answers
332 views

Where should 1em be defined - when to use lengths in “em”

The table in the document below looks as expected when using the article document class. With other document classes, the rules dissapear. The reason seems to be that booktabs defines the with of ...
17
votes
2answers
339 views

Defining a dimension with or without @

If I am writing a TeX package (as one can find such on CTAN), there are following approaches to define a new dimension length that should be changeable by a user of that package. Approach A: Define ...
28
votes
2answers
524 views

What is truecm?

In examples found around the web, some people specify lengths such as width=5truecm with \includegraphics or the geometry package. How is this different from regular 5cm?
5
votes
1answer
73 views

How do I forward a length from a command into a column specifier?

I'm using longtable where I want vertical bars separating cells, although not for the table headers. I have 8 columns (but show only 3 here as example) and want to re-use the same lengths on the main ...
10
votes
3answers
464 views

Retrieve length of a character

I'm creating a custom command which basically prints an horizontal line, a character and another horizontal line. The code would be ...
10
votes
1answer
3k views

How to fix TikZ node's height with \heightof?

I can use \widthof{text} to fix a minimum width of a TikZ's node. I would like to use \heightof{text} to fix its minimum height but it doesn't work. I just want to fill my nodes with one word but I ...
10
votes
1answer
2k views

How do I set \itemsep to rubber length?

I know that I can set \itemsep to any length like this, \setlength{\itemsep}{0pt} But if I want to set \itemsep to a rubber length (e.g. \bigskip), how do I do this? \setlength{\itemsep}{\bigskip} ...
3
votes
1answer
175 views

Changing options based on generated document length

I am creating lots of letters using the scrlttr2 package and some variables that change per letter. The contents of these variables might cause the letter to take up an additional page that I would ...
4
votes
1answer
294 views

retrieve the length of a segment

I want to retrieve the length of a segment in cm for display in a node As in the example below, I would like to display the length of three vectors \documentclass{article} \usepackage{tikz} ...
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% ...
0
votes
1answer
1k views

Set the length of 1ex

How can I set the length of 1ex? I tried \setlength{1ex}{4.40999pt} but I get errors.
3
votes
2answers
563 views

Changing length of an arrows from a vertex to itself

I'm working with LyX. I would like to change the length of an arrow from a vertex to itself. I would like to make the arrow stretch longer up before returning down to the encircled vertex. The code I ...
16
votes
3answers
2k views

How can I know the default PGF line width?

Is there some macro that will tell me what the default PGF line width is? I have tried creating my own macro by cloning \pgflinewidth before it has been modified, i.e. ...
3
votes
1answer
148 views

Is it at all possible to design a macro that expands to a length? [duplicate]

Possible Duplicate: Get width of a given text as length In an attempt to Compute the x distance between two nodes, the question arose whether it is at all possible to devise A macro that ...
5
votes
2answers
134 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
267 views

Other than syntax what is the difference between \dimen0= and \setlength{}{}?

I have been browsing around for a while trying to find an answer to the above question, and I have found some similar questions along with there answers, so I already have a vague idea how to answer ...
2
votes
1answer
136 views

Convert from float to length

I am using \pst@divide to divide a length in half \setlength{\RLEN}{4cm} \addlength{\RLEN}{\OFFSET} \pst@divide{\RLEN}{2cm}\RLEN ... \setlength{\DIST}{2cm} \addlength{\DIST}{\RLEN} % does not work. ...
7
votes
1answer
805 views

How to get width of equation

If I want to know the width of a text I use \settowidth{\MyLength}{bla}. Is there something similar for equations? More specifically I have \begin{align} a & b & c & d\\ c & d ...
7
votes
1answer
206 views

\parskip stretches more than expected

I wonder if I get something wrong with TeX’s glue concept. If define a length to be 2pt plus 1pt minus 1pt I expect that the length should be exactly 2pt where possible an if not it should be between ...
17
votes
4answers
2k views

A line of length \textwidth in TikZ

Why does the following latex document: \documentclass{minimal} \usepackage{tikz} \begin{document} \noindent \begin{tikzpicture} \draw (0,0) -- (\textwidth,0); \end{tikzpicture} ...
22
votes
5answers
356 views

Test if a given control sequence is a length register

I'm in need of a macro which receives a control sequence as argument and needs to branch if this macro is actually a length (of any kind, e.g. dimen, skip etc.) or "just" a normal macro (including one ...
4
votes
2answers
470 views

Visual debugging of lengths in paragraphs and environments?

During my searches, I found a couple of online images, which I doubt are produced with Latex - however, I found them immensely useful in understanding what is going on. I'm pretty sure the images ...
9
votes
2answers
360 views

Page geometry discrepancies

In the Companion 2nd Edition Table 4.2 shows page geometry values for various font sizes of the letterpaper paper size. These differ sometimes substantially from current values of the standard ...
4
votes
1answer
410 views

Lengths and for-loops

It seems that lengths are not updated in for loops. Compiling the code below: \documentclass{article} \usepackage{tikz} \newlength{\test} \newcommand{\inc}{\addtolength{\test}{1cm}} ...
9
votes
1answer
273 views

How to compute exact width added by \left. \right

I have defined macros to produce resizable brackets that also work across line breaks. This necessitated the use of and additional set of \left. and \right. which add a bit of horizontal space. ...
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{} ...
21
votes
3answers
3k views

How do I get the exact dimension of a picture in LaTeX?

This question is pretty simple: I'd like to have the possibility to get the exact size of a picture in LaTeX with, for example, the macro \the. In fact, I've founded the way \settoheight{} and so on, ...
8
votes
1answer
334 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 ...