{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

10
votes
2answers
95 views

Convert from physical dimensions to axis cs coordinate values

In answering PGFPlots: Howto draw a label at a zero of a function?, I got stuck on converting a length in pt to the actual coordinate value in the axis cs system. Here I only need the x value, but ...
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? ...
2
votes
0answers
40 views

Is there an TikZ command to provide the height and width of the picture? [duplicate]

I've found the following How can I compute the distance between two coordinates in TikZ?. So, I know how to find the size of a TikZ picture as follows: \documentclass{article} ...
3
votes
1answer
68 views

How to get the available space for an image

I want to design a figure (in a external graphics editor, e.g, Illustrator) to exactly fit (without scaling!) the whole available space on an empty page of my document minus the caption of the figure. ...
11
votes
3answers
628 views

Why is a 10bp picture environment not 10bp?

Example: \documentclass{article} \begin{document} \newlength{\picwidth} \setlength{\unitlength}{1bp} \settowidth{\picwidth}{\begin{picture}(10,10)\end{picture}} \typeout{width: \the\picwidth} ...
2
votes
1answer
63 views

Local scoping of textfloatsep

I was wondering if you can set the scope of \textfloatsep locally. I have found an old thread on Google groups, which points out that you couldn't. Has that changed by now? So what I want to do is ...
1
vote
1answer
55 views

Set a length that will adopt tikz's global lengths

I am trying to draw a rather simple tikz picture that consists of some very acurately defined levels. My code is \documentclass{article} \usepackage{tikz} \usetikzlibrary{plotmarks} ...
4
votes
1answer
66 views

Distinction between number and dimension in tikz key-value interface

When declaring shapes, I usually define the desired shape width with: minimum width = <number> <measure units> However, sometimes, I calculate calculate the shape's width separately. In ...
4
votes
2answers
98 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)} ...
6
votes
3answers
73 views

A version of \smash that interpolates between the true height/depth and the text-height/depth of the current line

I have a paragraph of text that includes a "deep" math symbol, one that dips below the ordinary bottom of the text a little. Originally I had nothing below that symbol; it was near the end of the ...
1
vote
2answers
51 views

Why is the width in nwu-lecture-style not working? [closed]

It seems that the code in nwu-lecture-style: \insertshortauthor[width=2cm-2pt,center,respectlinebreaks]\par% is not working? I tried: \insertshortauthor[width=2cm minus ...
10
votes
1answer
77 views

How to set a box to a rubber length width

Problem I'm trying to create fancy section heading using titlesec. I need to put the section name into a \parbox to have line breaks. I want the parbox to extend to the far right margin, but I don't ...
3
votes
1answer
145 views

Settting PGFplots axis environment options by means of \newcommand and {\newlength,\setlength}

Because I often use the same options for multiple axes in my LaTeX documents, I use the following code to simplify my life. \documentclass{article} \usepackage{pgfplots} ...
8
votes
1answer
141 views

Measuring align

From what I read it seems that align environments are processed twice: the first time for measuring, the second time for actual typesetting. My question is whether one can get access to these ...
2
votes
3answers
246 views

How to make table spanning textwidth [duplicate]

Consider the following code: \documentclass{article} \usepackage{booktabs,pgf} \begin{document} \pgfmathsetlengthmacro{\ratio}{\the\textwidth/4} \hrulefill \\ \begin{tabular}{@{}llll@{}} \toprule ...
4
votes
1answer
75 views

Writing to and extracting from aux not working?

Consider the following MWE: \documentclass{article} \newlength{\templen} \makeatletter \AtEndDocument{% \immediate\write\@auxout{\noexpand\setlength{\noexpand\templen}{150pt}}} \makeatother ...
5
votes
1answer
110 views

How do I access the width of text from the preamble?

I've got some macros that I want to set up in my preamble. The problem is that they need to know what the width of a typical line of text will be in the document. If I do something like, %% ...
2
votes
1answer
72 views

Conditional use of multicol

I'm using the multicol package to get two columns, but sometimes the contents is too wide in a particular column and I was wondering if there is a way to first make sure the contents will fit ...
2
votes
0answers
21 views

Behavior of \global when used with xifthen package [duplicate]

I'm trying to calculate the sum of some numbers in my document. I want to allow non-integer values, so I'm using lengths, which works just fine. In my document it's often necessary to specify the ...
5
votes
2answers
182 views

Measuring line length, using \hfill to justify text, wrapping and right justifying if space too small

I am a lecturer and have an issue when compiling test and exam questions. The questions will be in an enumerate environment and look something like this, where the marks shown in brackets are right ...
7
votes
3answers
173 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
102 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
245 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
292 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
89 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
156 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 ...
14
votes
3answers
247 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
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. ...
4
votes
3answers
173 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
87 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 ...
5
votes
1answer
101 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
247 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
153 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 ...
4
votes
2answers
248 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) ...
3
votes
1answer
15k 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
258 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
612 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
76 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
232 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
267 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
117 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
282 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
292 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
480 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
71 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
362 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 ...
9
votes
1answer
2k 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
160 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
174 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} ...