{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

9
votes
2answers
253 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
231 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
512 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 ...
19
votes
2answers
2k 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
705 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
623 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 ...
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 ...
28
votes
3answers
626 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
509 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?
142
votes
4answers
38k 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
686 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
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 ...
15
votes
2answers
2k 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]{% ...
8
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
931 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} ...
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}{ ...
9
votes
2answers
2k views

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

Question has been written above.
6
votes
3answers
385 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
284 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
373 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
950 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
699 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} ...
6
votes
2answers
1k 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
613 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, ...
22
votes
5answers
6k 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 ...
37
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 ...
17
votes
3answers
13k 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. ...