{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

260
votes
4answers
111k 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
1answer
39 views

Fancyhdr sets wrong headheight

I am having some issues with fancyhdr setting my \headheight. The package seems to add too much \headheight. This is my current set up: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[...
1
vote
3answers
55 views

How to convert \textwidth to mm and use the number as a command?

I am trying to convert \textwidth to other units I want and do calculations with the number (without the unit). How does one do this?
3
votes
1answer
30 views

Use temporary length \dimen255, temporary count \count255

This Question is mainly important for package writing: I read in the TeX-Book that \count255 and \dimen255 are traditionally used for temporary. Now the number of registers has risen (see this ...
2
votes
1answer
39 views

Convert count into length

I want to decrease a length by a number (count). I tried some variations with \newlength{\temp} and \addtolength but I got problems there with the minus. I also tried variants with \dimexpr. The ...
1
vote
0answers
12 views

LyX is changing horizontal spacing between words depends on the line's length - it even changes the page margins

I'm writing a paper in Hebrew and the margins of the equations from both sides is just too small, IF the line is long. What I mean that it feels like LaTeX is trying to push too much into 1 line, it ...
37
votes
5answers
13k 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 ...
4
votes
2answers
106 views

How to use \beamer@frametitle value as an argument to \settowidth

I was customizing a beamer theme that have to be used by many people at my workplace. I want to show an error whenever frame-title takes more than two lines. Please don't ask why title is so long. So ...
1
vote
1answer
38 views

Is there a simple way to create a local length

I want to redefine \textheight and \textwidth inside a \parbox. \textwidth works pretty well so far. But the textheight-part works only with the help of a \newlength. Unfortunately the \newlength will ...
3
votes
1answer
308 views

Why the measurement of vertical distance between two points is wrong?

Please, consider the following (not so minimal) MWE. Why the distance between points named a3 and b3 is not the same as the vertical distance between points a2 and b2 (it is about 30% larger)? From ...
2
votes
2answers
41 views

\foreach and \StrLen

I don´t know how to make a foreach with a StrLen inside it, is it possible? \documentclass[a4paper,12pt,hidelinks]{article} \usepackage[utf8]{inputenc} \usepackage[brazil]{babel} \usepackage[T1]{...
3
votes
2answers
51 views

Why is \setlength ineffective inside a tabular environment?

Why is \setlength ineffective inside a tabular environment? Here is an MWE: \documentclass{article} \newlength{\globallength} \newlength{\locallength} \begin{document} \setlength{\globallength}{10pt}%...
1
vote
0answers
15 views

How to find the length of a remaining line? [duplicate]

I'd like to put some lines on a page where a student can answer a question, and I'd like that line to go from the prompt to the right edge of the text. The most simpleminded and (therefore?) ...
3
votes
2answers
36 views

calc package and global lengths problem in tabularx

The output of the following code is affected whether calc package is included or not: \documentclass{article} \usepackage{tabularx} % \usepackage{calc} \newsavebox{\testbox} \newlength{\testlen} \...
2
votes
3answers
129 views

How to setup a longtable with booktabs and a colored (head) row

I'd like to make a longtable with the first (head) row colored in grey. Since booktabs inserts white space below the \toprule and above the \midrule, i need to insert a colored rule: \newcommand*{\...
4
votes
2answers
55 views

Sort array of words by length

I have a long array of words which I need to show in increasing order of length. I have tried to use the package arraysort and customize a comparator. My simplified code is: \documentclass{article} ...
2
votes
1answer
22 views

Passing length in form of a string instead of measure [duplicate]

I'd like to pass a measure of length in form of a string, i.e. \setlength{string} or \setlength{'string'} instead of \setlength{2.5cm} I seem to remember seeing something like that somewhere ...
3
votes
1answer
84 views

Arithmetic operation between command arguments and latex parameters

I'm defining a new command that places two images one next to the other and I want to add an horizontal space between the two images which corresponds to one third of the space that remains blank. The ...
28
votes
1answer
899 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 ...
8
votes
1answer
8k views

How do you increase headrule length in fancyhdr?

It's pretty well-known how to increase the headrule width, but how do I increase its length (i.e. let it run into the margin).
1
vote
2answers
41 views

How to set a length to the min of two other lengths?

I have declared several lengths in my document: \bottomMargin \topMargin and \initialPaperHeight. Right now, I am doing this \AtEndDocument{% \global\paperheight\dimexpr\pagetotal + \bottomMargin + ...
0
votes
1answer
58 views

Text overflows into graphics at bottom of page

I want to include graphics on every page after the title page but on the 2nd page the text flows into the graphics and I also loose the page number on that page. Subsequent pages are fine. Here is my ...
1
vote
0answers
45 views

geometry's bindingoffset seems to be ignored

The geometry's documentation tells: page 9: "bindingoffset removes a specified space from the lefthand-side of the page for oneside or the inner-side for twoside.", page 10 (caption of Figure 6): "...
2
votes
1answer
190 views

Difference between length and number (in the draftwatermark package)

I am using the draftwatermark package. According to the documentation, it is possible to set the horizental position of a watermark with the command \SetWatermarkHorCenter{⟨length⟩}. They say that <...
2
votes
1answer
41 views

Texts, lines and length

It is possible to set the width of the lines depending to text length (text aab's in MWE). Total length text aab's + line should be an equal. And I need also the "Text inside" on the same height as "...
2
votes
1answer
172 views

dotfill for length of text

I am trying to make some small dotted lines for the signature of different persons, with their printed names just below. I thought it would look great if the width and horizontal placement of the ...
3
votes
1answer
75 views

\columnwidth in cm

I have a silly question - i am using double column style \documentclass[english,a4paper,12pt, openany]{book} When I add a figure I usually put in \columnwidth and just let LaTeX to stretch it to ...
2
votes
1answer
1k 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 ...
4
votes
1answer
65 views

Automatically calculate width

This is a question to Werner's answer to the question "How to draw arrows between parts of an equation to show the Math Distributive Property (Multiplication)?". Consider the following code: \...
89
votes
3answers
25k 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 \...
3
votes
1answer
77 views

Converting lengths with lengthconvert and l3fp

The package lengthconvert "uses the modul l3fp to convert the length". But its conversions are totally off the charts: \documentclass{article} \usepackage{lengthconvert} \begin{document} \the\...
3
votes
2answers
2k views

What is the default length of \hrule?

When used without parameters, what varfiable controls the length of \hrule? I.e., how can I change the default length of \hrule, other than adding parameters to each instance -- say, to affect ...
1
vote
1answer
32 views

Is it possible to use mylatex or mylatexformat for documents with preambles almost the same?

I have documents of this form: \documentclass{article} \newlength{\variableLength} \setlength{\variableLength}{xxxx cm} \usepackage{package1} \usepackage{package2} \usepackage{package3} \...
18
votes
2answers
674 views

How to have a precise control on the size of each page?

I would like to produce a pdf document whose pages have various lengths and fixed widths. An easier situation The easiest case would be for instance: the first page has a length of 10cm all the ...
0
votes
2answers
80 views

Accuracy of distance measures in geometry

In the following MWE, I set the distance from the edge of the paper to the body text to be 25mm. \documentclass[a4paper]{article} \usepackage[showframe, paper = a4paper, tmargin = 25mm]{geometry} \...
2
votes
2answers
59 views

Typesetting displayed equivalences and definitions of unequal length

What is the proper way to typeset in LaTeX, in display-mode, a series of equivalences and definitions of unequal lengths of sets ? Consider for this the following code that I used for a series of ...
39
votes
2answers
63k views

What is the difference between \hspace*{\fill} and \hfill?

In the memoir manual on page 183 ,this example is given: \begin{figure} \centering \hspace*{\fill} {ILLUSTRATION 1} \hfill {ILLUSTRATION 2} \hspace*{\fill} \caption{Example float with two ...
5
votes
3answers
192 views

Comparing calculated real numbers

"\ifdimless" can compare two real numbers. But, how can we feed the result of a calculation to this function ? \documentclass[]{article} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{etoolbox} ...
4
votes
0answers
47 views

standalone package and user-defined macros/lengths

This is my first post on this amazing website, so hi to everybody!! I'd like to know if there is a way to pass some parametrs (macros or lengths) to a standalone file. Here is my MWE: Consider the ...
3
votes
1answer
70 views

use \boxput (fancybox) as reminder: is there a way to change the relative coordinate system to the top of the box?

I use the fancybox's \boxput command to create reminder boxes in my documents. I like the fact about \boxput, that it lets you place a label above the box. This label is placed like a water mark, ...
0
votes
0answers
32 views

subheading of titletoc exceeds dotts and beginning of pagenumber

I am using titletoc like this: \usepackage{titletoc} \newcommand\frontmatterchaptoc{% \titlecontents{chapter}[1.4em]{\addvspace{3pt}}{\contentslabel{-0.25em}\hspace{2em}}{\hspace*{-1.3em}\...
3
votes
1answer
94 views

Get the width of a picture with Tikz

I 'm trying to make a presentation with beamer and I use Tikz to incorporate pictures at some places in my frames. For some reasons, I would like to fixe the heigth of a picture (contained in a node) ...
1
vote
1answer
77 views

Trim size as fundamental TeX value

What are the fundamental TeX length names, corresponding to trim size and offsets? I already know that \pdfpagewidth and \pdfpageheight will grab enough information to calculate the PDF MediaBox (in ...
4
votes
1answer
83 views

Length operation within a newtcblisting

Consider the following code: \documentclass[10pt,letterpaper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[french]{babel} \usepackage{calc} \usepackage{tikz} \usepackage{...
0
votes
0answers
64 views

Geometry package: Lengths saved by default. Options for save/load/restore

The geometry package: Package lengths are not saved as lengths. Examples: layoutheight, tmargin The following only affect the complete layout: \savegeometry \loadgeometry \restoregeometry ...
3
votes
1answer
48 views

Computation of size in titlespacing

Consider the following example: \documentclass[11pt,a4paper]{book} \usepackage{lipsum} \usepackage{titlesec} \newlength{\textsize} \makeatletter \setlength{\textsize}{\f@size pt} \makeatother \...
9
votes
2answers
661 views

Length plus minus other length?

Consider the following example: \newlength{\textsize} \makeatletter \setlength{\textsize}{\f@size pt} \makeatother \setlength{\parskip}{12pt plus 1pt} % WORKS \setlength{\parskip}{\textsize plus 1pt}...
3
votes
1answer
345 views

How to change length of blue line in moderncv

I am writing my cv using moderncv; I come across to this automatic correction where sentences are split in 2 lines like so: What I would like to do is setting "Birth Date and Place" in the same ...
6
votes
1answer
819 views

Why does changing \baselinestretch not change line spacing?

I have read that line spacing in a LaTeX document is controlled by the \baselinestretch macro, for example here. Setting \baselinestretch in the preamble does in fact change line spacing. When I ...
3
votes
1answer
190 views

Can I define a variable to scale with it several figures?

I have several pictures in my document, using the subfigure environment, the code is the following: \begin{subfigure}[b]{0.22\textwidth} \includegraphics[width=\textwidth]{pictures/...} \end{...