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
2
votes
1answer
23 views

How to recover value of current line spread?

I want to set linespread to a value then go back to the previous value it had. How do I do it? Something like: \let\oldlinespread\linespreadvalue \linespread{1} \printmystuff \linespread{\...
1
vote
2answers
39 views

Command to return both font size class and font size in pt

I am looking for a command to return both the font size class and the font size in pt. The following approach from @Alan Munn as per this SE post prints font-size values for all standard classes: \...
163
votes
4answers
58k 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 \...
2
votes
0answers
26 views

Measuring maximum height of row within align

Is there a way to extract the maximum height of a row within an align environment? For example, given \begin{align} a &= \frac{1}{2}\\ b &= 0.25 \end{align} I would like to extract the height ...
-1
votes
2answers
14 views

Length of a one line string

In the following TNWE (Tiny Not Working Example), I would like to align the braces on the right by calculating the lenghts of the texts such as to use \kern to fill spaces on right. Maybe blackmagic ...
2
votes
3answers
71 views

witharrows - Problem to use a length given by \settowidth

The following code doesn't use the offset given by \myl. What am I missing ? \documentclass{article} \usepackage{witharrows} \newlength\myl \newcommand\doublearrow[2]{ \settowidth\myl{#1}%plus ...
1
vote
1answer
26 views

Centered text, but at almost equal line lengths

My goal is to typeset a short, centered text in a way that the difference in line lengths is minimal. Or, to put it differently: In a way that the width of the block is minimal without increasing its ...
0
votes
2answers
28 views

Align & match length of \rightarrow and \xrightarrow

In the following example, I want to make \rightarrow be the same length as the \xrightarrow, while aligning the two. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation} \...
0
votes
1answer
36 views

How can I use “0pt plus 1fil + \baselineskip” as a length?

I'm trying to declare a new section command in KOMA-Script which is formatted exactly like part. According to the user guide the default for beforeskip is 0pt plus 1fil + \baselineskip. Unfortunately ...
1
vote
1answer
38 views

TikZ-matrix over whole textwidth

I try to create a TikZ-matrix like that: where bot rows had the height ca. 3cm. row 2 column 1 is planed as something like a multicolum. But in the first I have problems with the last column of row ...
2
votes
2answers
65 views

Using \setlength inside \mathchoice

I've written some somewhat complex tikz macros which use a length to set their scale. I've realised I want them to have a different scale when used inside display math versus inline math mode, and I ...
0
votes
1answer
28 views

Why is this space being inserted when using \newcommand and \setlength? [duplicate]

I'm trying to debug some \newcommand macros I'm working on, and I've got it down to this minimal example. All it does is define two lengths and then set their values - it doesn't use them for anything....
1
vote
3answers
138 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 + ...
1
vote
1answer
25 views

\settoheight is slightly shorter than actual height

I am trying to set a length to the height of a heading. I have the following snippet. % heading height \settoheight{\headingh}{\Huge{\textbf{\heading}}} \centering\Huge\textbf{\heading}\rule{0.1mm}{\...
15
votes
2answers
6k 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 ...
25
votes
4answers
10k 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} \setlength{\myLength}{\...
50
votes
4answers
60k 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. \...
5
votes
3answers
306 views

\somepenalty=10000 vs. \somepenalty 10000 vs. \somepenalty10000

Replacing the equality symbol with a space below or omitting the symbol at all \documentclass{article} \pagestyle{empty} \usepackage{lipsum} \begin{document} \interlinepenalty=10000 % or \...
0
votes
1answer
33 views

How to properly halve the inter-line distance in a math block environment

... of amsmath or mathtools? In other words, how to properly halve \jot? Options: \setlength{\jot}{.5\jot\relax} \setlength{\jot}{\dimexpr.5\jot\relax} \setlength{\jot}{\dimexpr\jot*.5\relax} \...
1
vote
1answer
21 views

align environment multiline equations - starting equality and inequality slightly from left the avoid page cutoff

I am using align environment to write quite huge multiline equations. The following latex source code generates the following screenshot \begin{align} \Bigl\|\sum_{i=1}^{k-1}\phi(s_t^i,a_t^i)[\...
0
votes
1answer
72 views

Chemfig: fixed bond length and vertical alignment

I have two reaction schemes and one is a skeletal representation. I want all of my bonds to be a certain length, so I set the option fixed length = true and atom sep=1.5em. This gives me the above ...
1
vote
1answer
32 views

Relax a command within an environment

A new environment is to be designed which prints some length. The environment is used multiple times in the document, hence the length is calculated more than once, leading to error "command #length# ...
0
votes
0answers
26 views

Curly brace to depict length in TikZ [duplicate]

Can I make long curly braces to depict lengths on a graph like this?
3
votes
1answer
112 views

Powerpoint-like animations with beamer and the animate package

I want to achieve a simple "fly-in"-animation with LaTeX by utilizing the animate-package. My idea was to insert an \hspace with decreasing length-argument. However, there is no animation at all. MWE ...
0
votes
1answer
92 views

Why does \ifdim work here but \if doesn't?

I'm very new to LaTeX, and need to compare a length I've defined with a default value (and set another length accordingly). Consequently, I'm exploring the murky (to me anyway) world of LaTeX ...
4
votes
1answer
79 views

Setspace package changes behavior of \abovedisplayskip

When using the spacing environment from the setspace package, it appears that rubber lengths in \abovedisplayskip and \belowdisplayskip are being ignored. \documentclass{article} \usepackage[nopar]{...
1
vote
1answer
74 views

negative character space (negative version of `\ `)

There is a negative thinspace \! which is a negative version of \,. Is there a negative version of normal character space \ too? I could not find it in: Lengths and when to use them, What commands ...
1
vote
1answer
120 views

Tikz: use latex length for length of path (ditto marks)

I want to draw a ditto line, which is a horizontal line with two small marks in the middle. My first attempt was \dittoLatex which uses a box with characters and rules, but is frankly ugly. My ...
3
votes
1answer
55 views

tikz arithmetic with numbers and lengths

Consider this example: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \def\starty{3} \def\length{1}; \coordinate(a1) at (1, \starty); \...
25
votes
6answers
631 views

Test if a given control sequence is a length register

I'm in need of a macro which receives a control sequence as argument and needs to branch if this macro is actually a length (of any kind, e.g. dimen, skip etc.) or "just" a normal macro (including one ...
1
vote
3answers
92 views

\def, math, and order of operations, expansion?

I have what looks like a simple task but I cannot seem to get it to work. take the following: \def\varlength{1in}%has units \def\varscalar{0.2}%does not have units \raisebox{\varscalar\varlength}[...
4
votes
1answer
55 views

Shortening lengths in LaTeX

I'm trying to create a a bipartite object that has the \textwidth at most, and doesn't overflow from the right, but has the width of the separator given as an argument. I attempted to achieve this ...
2
votes
1answer
48 views

How to put a text over symbols, part 2

Building on How do I put text over symbols? I created a new command : \newcommand{\myequ}[1]{\stackrel{\mathclap{\normalfont\mbox{#1}}}{=}} which gives overwriting : when #1 is too long. Is there a ...
20
votes
2answers
6k 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 ...
2
votes
1answer
48 views

Why does `settowidth` not work inside `foreach`?

I would expect the first two a to be wide apart on the first line.. \documentclass{report} \usepackage{tikz} \begin{document} \newlength{\mylength} \foreach \i in {dum,iteration} {% \...
5
votes
1answer
151 views

How to Set Lengths (Glue/Skips?, not Dimensions), in LuaTeX?

I am trying to define a length, (not a dimension)—using Lua. But, I am having trouble with the syntax. I think I am supposed to be using the same structures/prototypes as glue_spec in order to still ...
1
vote
1answer
58 views

Problem with lengths and images

I'm trying a simple page with an image in the top of it as a header and an square image centered in the rest of the page. I would like the images to fill the full page width. After trying some ...
0
votes
1answer
35 views

Neat alignment of titlerule, text in tabular, and text in longtable

I'm having some trouble getting things to line up neatly. To be clear, I don't want everything to be the 'same length,' rather, I want it to fit aesthetically so that with multiple sections and ...
4
votes
1answer
115 views

exam: Macros for printing the values of \labelwidth and \labelsep for question/part

How can I print the values of \labelwidth/\labelsep for both questions and parts? \documentclass{exam} \usepackage{verbatim} \renewcommand{\questionshook}{% \setlength{\leftmargin}{0pt}% \...
4
votes
2answers
181 views

How to make the arrow in a chemical formula shorter? (using mhchem)

I'm using mhchem to write a chemical formula, as in the example by clemens (shown below). Is there a way to make the main arrow -> shorter by a fixed value in the second equation? Here's the code: ...
0
votes
2answers
41 views

rule length equal to length of item text paragraph

How can I get the width of the rule equal to the text for each item paragraph ? Any advice ? \documentclass[french,12pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{...
10
votes
2answers
2k views

Divide two lengths

How do I divide two lengths and get a length out? \documentclass{article} \newlength\A \newlength\B \newlength\C \setlength\A{10pt} \setlength\B{5pt} \setlength\C{\dimexpr\A/\B\relax} \begin{document}...
1
vote
1answer
42 views

Ifoddpage statement inside switch case

Continuation of topics tcolorbox: specific width and height settings for odd and even pages and Distance Variable in front or back pages. I'd like to set lengths conditionally based on the expansion ...
2
votes
1answer
55 views

How to get the font size parameter passed to the main standard classes?

For complex length manipulation (see here), I would need to get the font size that was passed as an option to the document class: \documentclass[12pt]{article} \newlength{\mainfontsize} \setlength{\...
1
vote
1answer
56 views

How to do something after @ifnextchar?

In my LaTeX file, I'm using \usepackage{indentfirst}. And there I've defined a command: % ################################################## % % Coding skills % ---------- Usage example ---------- % ...
1
vote
0answers
46 views

calculate the title height and if the title height is above some number then add some space

calculate the title height and if the title height is above some number then add some space. when I use the code get the title, but when I use code like this \settoheight{\heightoftitle}{\vbox{\...
4
votes
0answers
53 views

Alignment of an un-numbered multicolumn tcolorbox listing

Consider the following code: % Preamble \documentclass[letterpaper, 10pt]{article} \usepackage{calc} \usepackage{xcolor} \usepackage{listings} \usepackage{multicol} \usepackage[most]{tcolorbox} \...
7
votes
3answers
575 views

How to get depth and other lengths of a font?

Red line in the output is \baselineskip, the only length in question that I know of. The output image provided here is an edited image in which (red line representing \baselineskip is re-positioned to ...
2
votes
2answers
118 views

Calculate metric length in LaTeX (e.g. for TikZ)

I would like to calculate the length of elements on a LaTeX beamer frame (128mm*96mm) equivalent to those on a PowerPoint slide (254mm*190.5mm), i.e. apply the factor 128/254 to a value given in mm. ...
3
votes
2answers
144 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\...

1
2 3 4 5
8