Questions tagged [lengths]

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

Filter by
Sorted by
Tagged with
4
votes
2answers
411 views

Defining macro \gsetlength as global setlength, reliable?

As is noted in other questions, such as Global scope or permanent length or savebox, the \setlength command does not always have global effect. In many cases, that is desirable. But when the effect ...
4
votes
1answer
406 views

How to divide two lengths and get a result as an integer?

I have a problem dividing two lenghts and getting a result as an integer. I was trying to use this package: \usepackage[nomessages]{fp} It didn't really work for me. I tried it multiple ways, but it ...
4
votes
1answer
1k views

Disable \setlength{\parskip}{\baselineskip} on \tableofcontents

I use \setlength{\parskip}{\baselineskip} and it is great. But I want to disable it just for the \tableofcontents. Is it possible?
4
votes
1answer
219 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 ...
4
votes
1answer
2k views

scrlttr2 location positioning question

I would like to have the text of the variable location to be right aligned with the text of the main body. So I tried to redefine the length lochpos to be the same as refhpos, because the margin on ...
4
votes
1answer
3k 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 ...
4
votes
1answer
5k views

How to set the radius of rounded corners relatively to default unit

Background: When I draw a tikzpicture, I use only the default units (i.e. I do not specify any unit, as in \draw (0,0) -- (1,1);). Issue: When no unit is given in the [rounded corners = <value>]...
4
votes
2answers
167 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} ...
4
votes
1answer
693 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}} \newcommand{\incs}...
4
votes
1answer
292 views

Measure and retain lengths between tabular rows

I need elements in a tabular environment to set some lengths and be able to access these lengths in another row of this same table. But it appears that adding \global in front of \settoheight and \...
4
votes
1answer
270 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 ...
4
votes
1answer
2k views

A tcolorbox centered and automatically adjusted to the current text size

Consider the following code: \documentclass[a4paper, 10pt]{article} \usepackage[margin=2cm]{geometry} \usepackage[listings,skins,theorems,breakable]{tcolorbox} \usepackage{lipsum} \usepackage{...
4
votes
1answer
195 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 \begin{...
4
votes
1answer
638 views

Better alignment for enumitem list

In the following screenshot, the alignment of the 2nd A) and the space between the label of the 2nd list and the fraction have been obtained empirically n: see \hspace*{1.375em} and label*={\Alph*)\,\,...
4
votes
2answers
72 views

Can I make a flexible page length?

In my document, I have many large unbreakable boxes. Sometimes, the text will take up most of the page before a box that is a little too big to still fit. Consequently, I am often manually using \...
4
votes
1answer
163 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{...
4
votes
1answer
2k 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 line ...
4
votes
1answer
407 views

A pgf plot problem

I'm new to pgfplot and I have a pgfplot problem. figure 1 :As you can see the line is going through the number '2'. How can i fix it? figure 2: Also can i fix the line length, going through 2, ...
4
votes
1answer
725 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
1answer
109 views

Is there a pre-defined width that covers the text area and the margin?

Is there a pre-defined width that covers both the text and margin areas? Correct me if I am wrong, but it would basically be equal to \textwidth+\marginparsep+\parginparwidth. Is that provided by ...
4
votes
1answer
2k 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 ...
4
votes
2answers
101 views

Wrapping a length

I've cobbled together the \basis macro which sets and gets a hidden/internal length \b@sis. It is meant to work as follows : Calling \basis returns the value of \b@sis Calling \basis{} sets \b@sis to ...
4
votes
1answer
680 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 ...
4
votes
1answer
209 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 initialization ...
4
votes
1answer
125 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
3answers
236 views

How can I separate the number from the unit in argument?

Let us say that I have a function, in which I give a number plus a unit. I would like to get only the number, is it possible ? Here is a MWE: \documentclass{article} \usepackage[utf8]{inputenc} \...
3
votes
2answers
118 views

How to properly capture return value of a command?

I have a problem with capturing returned value of my command. Here is my preamble with command definition: \documentclass[convert={density=300,size=800x600,outext=.png}]{standalone} \usepackage[utf8]...
3
votes
3answers
34k 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 ...
3
votes
2answers
460 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 ...
3
votes
1answer
194 views

What is the difference between assignment, \setlength and \renewcommand when changing a variable?

I want to set the \extrarowheight to 0.5ex. I find the following three ways are all applicable. \extrarowheight = 0.5ex \setlength{\extrarowheight}{0.5ex} \renewcommand{\extrarowheight}{0.5ex} Just ...
3
votes
2answers
111 views

Does expl3 have alternative to \settowidth and \settoheight?

How can I substitute following code with expl3 interfaces (that do the same job)? \documentclass[varwidth]{standalone} \begin{document} \newlength\spaceWidth \settowidth{\spaceWidth}{\ } \the\...
3
votes
1answer
2k 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 ...
3
votes
2answers
1k 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 ...
3
votes
2answers
127 views

Actual table column width is unequal with set number

I want to create a table with fixed column lengths like this: \documentclass[a4paper,12pt]{article} \begin{document} \begin{tabular}{|p{1cm}|p{2cm}|p{3cm}|} \hline 1 cm & 2 cm & 3 ...
3
votes
2answers
316 views

How to obtain specific distance between image and caption in beamer?

I'm trying to set the the caption 1pt below the image in a figure in beamer. If I set \abovecaptionskip to 0pt there is still a gap between the image and the caption. This results from the \...
3
votes
1answer
2k 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} \newcommand{\linecolora}{blue}...
3
votes
2answers
3k 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 ...
3
votes
1answer
1k views

LaTeX equivalent of \wd [closed]

Please consider the following code: \newsavebox{\mybox} \savebox{\mybox}{some text} \newlength{\widthmybox} \settowidth{\widthmybox}{\usebox{\mybox}} Is \widthmybox then equivalent to \wd\mybox?
3
votes
1answer
415 views

settowidth in substack

I am aware of Align in Substack, but I am trying another solution and would like to understand why it is not working: \documentclass{article}% \usepackage{amsmath}% \newlength{\mylength}% \newcommand{...
3
votes
2answers
147 views

Updating length variable inside longtabu working strangely

I have a table, and I want one column to show a running total on each line, i.e., it has to show the total of the values of another column up to that row. I thought about accumulating the total into a ...
3
votes
2answers
1k 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} \setlength{...
3
votes
3answers
79 views

Disappearing custom length in enumitem

I am setting a custom length to equal the value of \leftmargin inside an enumitem list. Once I exit the list though the value disappears and my custom length reverts to zero. I have shown the ...
3
votes
1answer
352 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) ...
3
votes
2answers
1k 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 ...
3
votes
1answer
1k views

Adding lengths with the plus and minus syntax

Is it possible to add macro lengths with manually coded numbers or with other macros in a length input, (as opposed to needing to use \addlength)? MWE: See \setlength{\xfootskip}{\xfootheight plus 0....
3
votes
1answer
429 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 ...
3
votes
2answers
72 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} \...
3
votes
1answer
968 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
584 views

Dynamic length variable with argument? (like “\setlength{\foo}[1]{0.5+#1*0.5}”)

Is there a way to define some kind of a length function that takes an argument, sort of a mixture between \newcommand and \setlength? The following example should illustrate what I want. (I'm using a ...
3
votes
1answer
163 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 ...