{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

1
vote
1answer
753 views

How to set scrlttr2 refvpos automatically based on address length

I am creating an letter options (lco) file that I will use for multiple letters. The scrlttr2 class is designed for a fixed placement of the address field, and places the date at a fixed position from ...
16
votes
2answers
2k views

How to preserve the same parskip in minipage

I have following structure: \begin{document} Paragraph1. Paragraph2. \begin{minipage} Some paragraph1. Some paragraph2. \end{minipage} \end{document} How can I make the same spacing between ...
81
votes
2answers
48k views

Lengths and when to use them

There are many lengths in LaTeX. For instance, \enskip, \enspace, \quad, \parskip, \smallskip, ... Some of them are mostly used for vertical spacing, some others are mostly used for horizontal ...
3
votes
1answer
815 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
678 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 ...
4
votes
2answers
719 views

fontsize setting with newcommand and newlength

How do I set a \newcommand so that the field #1, which is calculated to be 1.2*#2 Optional? Something similar to the following commands, but that did not work. \documentclass{article} ...
9
votes
2answers
403 views

How can I globally set pgfmathsetlength?

How can I declare a length via pgfmathsetlength global? The example results in 20pt -- 5pt -- 20pt But I had expected: 20pt -- 5pt -- 5pt \documentclass[10pt]{article} \parindent0pt ...
14
votes
4answers
1k views

Conversion pt to mm or cm

Is there any way how to convert pt to mm or cm in plain TeX?
1
vote
1answer
324 views

Use pgfplots and a custom length to define global width when inputing the plot

I'm trying to set the width for all my plots, that are defined in other files and imported into the main document, using a custom width, \sz. I'm trying to set this length because I want to change it ...
4
votes
1answer
327 views

What does a number followed by “ in” mean?

The TeX syntax highlighter that I use colors all occurrences of a number followed by " in", e.g. 0 in or 32 in in a dangerous bright red, in almost all contexts. Why?
5
votes
1answer
567 views

TikZ, foreach and sum

I'm trying to create a list of rectangles of various sizes, starting at the end of the previous rectangle. I'm using a foreach loop with a TeX length, but I don't get the result I want, and I really ...
2
votes
2answers
989 views

Length parameter for vertical skip space in a math environment?

I learned here that I can use \\[<len>] to explicitly set the vertical skip space between lines, e.g., <len> set to 3ex. I'd like to set <len> to, say, 2-times the normal length in ...
9
votes
2answers
2k 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} ...
3
votes
2answers
490 views

Linewidth resets when using input files

I'm trying to set some figure files in standalone .tex files, and then input them in the main file. Those files looks something like this \ifx \plotwidth \undefined \newlength{\plotwidth} ...
2
votes
3answers
350 views

Make a length negative

I was wondering if there is a way to have a \negate command which makes lengths negative. So you could do things like: \newlength{\negativeabovecaptionskip} ...
7
votes
4answers
807 views

Is there a way of limiting the scope of \newlength?

Is there a way of limiting the scope of \newlength? I'm using the same name in many TikZ picture but each with different value, and I don't want it to live on between the pictures as it's not intended ...
10
votes
1answer
785 views

Why do \setcounter and \addtocounter commands have global effect, while \setlength and \addtolength commands obey the normal scoping rules?

The \setcounter and \addtocounter commands have global effect, while the \setlength and \addtolength commands obey the normal scoping rules. Why were they designed like this? Why are ...
0
votes
1answer
213 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} ...
9
votes
2answers
259 views

Confused with whether or not I have to use \the

I got confused with whether or not I have to use \the. \the in \special{papersize=\the\paperwidth,\the\paperheight} is mandatory. But \the in neither ...
4
votes
1answer
235 views

Length needs backslash but counter does not, why?

\documentclass{minimal} \parindent=0sp \newlength{\Length} \setlength{\Length}{1in} \newcounter{Count} \setcounter{Count}{10} \begin{document} \the\Length \theCount \end{document} Length needs ...
9
votes
1answer
541 views

How does PDF or PDF Viewer define a rounding rule for stroke thickness?

I defined a sequence of line segments of different thickness each as follows. \documentclass{article} \usepackage{multido} \parindent=0sp \begin{document} ...
3
votes
1answer
2k views

A new paragraph followed by a big skip

Here is the code I am using to place a heading with a line above and below the text, from this post. \newcommand{\rheading}[1] { \par \bigskip \hrule height 1pt \kern 5pt \hbox to ...
20
votes
2answers
3k views

What are the differences between \newdimen, \newskip and \newlength?

What are the differences between \newdimen, \newskip, and\newlength? When should I use each of them? Please give me a non-trivial example for each case.
4
votes
2answers
775 views

Is there a command to convert cm to bp?

I want to convert a length in cm (centimeter) to bp (big point). Is there a command to convert cm to bp?
21
votes
2answers
642 views

Which is better: a dimension or a macro?

When messing around with TikZ/PGF then I frequently find myself wanting to store a length for later use. By "length" here, I mean the word in its non-TeX meaning. As I'm doing stuff in TikZ/PGF then ...
47
votes
3answers
11k 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 ...
28
votes
3answers
677 views

Is there a picture showing all the lengths used in lists?

I want to adjust the length parameters in a list (happens to be to make it more condensed, but that's not relevant). I do this infrequently enough that I don't remember all the lengths that are ...
11
votes
3answers
529 views

Measure the length of the lowercase alphabet

In the memoir manual speaks about measuring the length of the lowercase alphabet in order to decide the numbers of characters per line. Can this be done with LaTeX?
158
votes
4answers
45k views

Difference between \textwidth, \linewidth and \hsize

The three lengths \textwidth, \linewidth and \hsize seem to all hold the width of the current line. At least I never saw some real difference between \textwidth and \linewidth in my code. Both seem to ...
3
votes
2answers
734 views

How to convert number to length?

I'm trying to generate a "word cloud" by using \mboxes with random spaces around words. In the code below I've removed stuff that change the font size, and I've replaced \mboxes by \frameboxes for ...
12
votes
2answers
916 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 ...
19
votes
2answers
3k views

What is the difference between \def and \newlength?

I wrote the following LaTeX documents. \documentclass[11pt]{book} \newlength{\mywidth} \newlength{\myheight} \setlength{\mywidth}{85mm} \setlength{\myheight}{112mm} \newcommand{\setpagesize}[2]{% ...
9
votes
2answers
4k views

Getting length as number?

I have probably formulated the question wrong, as I don't know the Tex internals - but this is what I mean; consider this example: \newcommand{\myNum}{2} \newlength{\myLength} ...
7
votes
4answers
1k views

A macro that expands to the length of its argument

If I want to anonymise a paper I've written for review, I don't just want to delete my name from the author field. I want to replace my name with a rule as tall as a capital letter and as long as my ...
12
votes
1answer
2k views

Tikz - move/reposition arrow decorations (arrowhead length/size)

I'm trying to build a 'dimension line' macro for Tikz: \documentclass{article} % note: with \documentclass{minimal}, this example fails with: % ! Undefined control sequence. % ...
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} ...
15
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}{ ...
9
votes
2answers
3k views

What is the difference between \fboxsep=1cm and \setlength{\fboxsep}{1cm}?

Question has been written above.
7
votes
3answers
403 views

How to detect the length of the tallest letter and that of the deepest letter of the current font size?

My idea is to redefine the \strut to be as short as possible. It means the length of strut is the sum of the tallest letter length and the deepest letter length.
5
votes
1answer
288 views

How to pass the value of \mylength to the “trim” option of \includepdf of pdfpages.sty?

This problem is related to my previous problem about pdf trimming. Here is the minimal code: \documentclass{article} \usepackage{pdfpages} ...
9
votes
3answers
383 views

Making register declarations local, Undefining a register (count, toks, etc.)

Is it possible to make \newcount, \newtoks, etc. respect grouping, so that, e.g., \newcount\temp\temp=2{\newcount\temp\temp=1}\showthe\temp gives 2 (instead of 0)? Relatedly, is it possible to ...
8
votes
1answer
2k views

Minimum length for \xrightarrow

I want to place text over arrows. The obvious choice is to use the amsmath command \xrightarrow{#1} However, sometimes the text above may be a single digit: %Example 1 \xrightarrow{1} other times ...
3
votes
1answer
1k views

Trouble setting a length [closed]

I'm starting with LaTeX, and there are things that puzzle me. I'm trying to set a length that's the \textwidth minus (let's say for example) two inches. In the preamble, I wrote: \newlength{\bplen} ...
9
votes
2answers
714 views

Does {1em} mean {1em plus0pt minus0pt}?

Is plus0pt and minus0pt automatically added if I write, e.g., \setlength{\abovedisplayskip}{1em} \setlength{\jot}{0pt} \setlength{\parsep}{0pt} ...
7
votes
2answers
2k views

How can the dimensions of a box be retrieved with LaTeX

One can specify a box in LaTeX, using various methods for example: \newsavebox{\Abox} \savebox{\Abox}{\parbox{4cm}{\lorem}} \usebox{\Abox} How can I retrieve the width, height and depth of the ...
6
votes
1answer
643 views

How to align underlined text and a horizontal line created with \rule

As described in this question I'm using the tocloft package to customize the table of contents. We are putting a horizontal line under the whole section text up to the page number. Therefore we ...
11
votes
3answers
1k views

String replacement in LaTeX

I'd like to know how to replace parts of a string in LaTeX. Specifically I'm given a measurement (like 3pt, 10mm, etc) and I'd like to remove the units of that measurement (so 3pt-->3, 10mm-->10, ...
23
votes
5answers
7k views

How can I change the indentation in quote and quotation environments and commands?

I need to change the indentation that the quote and quotation environments and commands employ. I assume that there is some length I need to set, but I've googled around, and cannot find what I am ...
38
votes
2answers
2k views

Is there a \show for lengths?

The \show command is extremely useful for figuring out what's going on with a particular macro. Similarly, using \the can tell me the value of a counter. I'd like to know if there's something ...
18
votes
3answers
14k views

Determine text width

For sizing figures in LaTeX it's helpful to know how wide the text is so that figures can be sized to match without rescaling. LaTeX provides \textwidth for reference by other commands, e.g. ...