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
3
votes
1answer
82 views

Custom error message for bad length value?

Using LuaLaTeX in texlive2017, but I assume that this would apply generally. Question: Is it possible to set a custom error message, that will be shown when a bad value is used as the argument to a ...
3
votes
1answer
377 views

\setlength{pdfpagewidth}{8.5in} not working in sharelatex

I am writing a paper for AAAI-18, which requires the following commands to be pasted near the top of the document: \setlength{pdfpagewidth}{8.5in} \setlength{pdfpageheight}{11in}\\ Neither of these ...
3
votes
1answer
2k views

beamer: How to get height for frame content [duplicate]

I want to put a picture in a beamer slide and make it use all the available height of the frame. So I tried: \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage{graphicx} \begin{document} ...
3
votes
1answer
190 views

using \textheight and \baselineskip in scrartcl

I want to tell nomencl to print all items on a single page. If I use \documentclass{article} my code to let LaTeX compute the right length for nomitemsep itself works fine. But if I use \...
3
votes
1answer
188 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 \...
3
votes
1answer
331 views

Using \textwidth via strip@pt with beamer and the picture environment

OK, I admit I haven't tried my MWE without Beamer. My goal is to use e.g \textwidth with the picture environment, and my overall goal is to include several rectangular portions of an .eps file within ...
3
votes
1answer
196 views

How to get the available space for an image

I want to design a figure (in a external graphics editor, e.g, Illustrator) to exactly fit (without scaling!) the whole available space on an empty page of my document minus the caption of the figure. ...
3
votes
1answer
227 views

Is it at all possible to design a macro that expands to a length? [duplicate]

Possible Duplicate: Get width of a given text as length In an attempt to Compute the x distance between two nodes, the question arose whether it is at all possible to devise A macro that expands ...
3
votes
1answer
2k 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} \...
3
votes
1answer
38 views

Printed length in Layouts package inaccurate?

From the layouts package manual (page 3 and 4): The textwidth is \printinunitsof{pt}\prntlen{\textwidth} which is also \printinunitsof{in}\prntlen{\textwidth} or \printinunitsof{mm}\prntlen{\...
3
votes
1answer
84 views

get width and height of character in the power

I want to create a "minus-sign" in a superscript of a letter in math mode using \rule{width}{height} to get control over the look of it. In principle, I get something to my liking, but I fail to make ...
3
votes
1answer
194 views

Remove stretch and shrink (glue) from existing length

Suppose I have a length \mylength, defined to be \setlength{\mylength}{5pt plus 1pt minus 2pt} I'd like to make \mylength a fixed length, but keep the default length. In this example, I'd like \...
3
votes
1answer
127 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: \...
3
votes
1answer
241 views

Changing options based on generated document length

I am creating lots of letters using the scrlttr2 package and some variables that change per letter. The contents of these variables might cause the letter to take up an additional page that I would ...
3
votes
1answer
60 views

How align paragraph with labels before resume enumitem list

I have an enumerate list created with enumitem that I interrupt and then resume. Between the last item before the interruption and the first after the resumption, I insert a text paragraph. How can I ...
3
votes
1answer
76 views

TikZ: Using current length inside scope environment

Following this answer: Drawing on an image with TikZ, I'm using \begin{tikzpicture} \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{some_image.jpg}}; ...
3
votes
1answer
469 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[...
3
votes
2answers
127 views

Using skip (glue) with pgfmath (truncating plus/minus parts from a glue length)?

Consider the following MWE: \documentclass{article} \usepackage{tikz} \newlength{\tlen} \newlength{\tlenB} \begin{document} \setlength{\tlen}{2cm} \typeout{check 1, tlen is: \the\tlen} \...
3
votes
0answers
34 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} \...
3
votes
0answers
151 views

Can one use the Potrzebie unit system in (La)TeX?

Inspired by a comment to this answer (and some wasted but entertaining time on the internet), I was wondering if somebody has implemented the use of the Potrzebie unit system in (La)TeX, as a tribute ...
2
votes
3answers
814 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} \setlength\negativeabovecaptionskip{\...
2
votes
2answers
148 views

Store result of \ratio calculation for repeated use

I am using pdflatex with the beamer package to create a presentation template that is similar to the PowerPoint template provided by my company. I want the company logo to have the same size in my ...
2
votes
2answers
807 views

What is the difference between ‘truemm’ and ‘mm’ etc.? [duplicate]

Sometimes I see the use of truemm (or true mm) instead of mm (same for other units). So I’m wondering what is the difference between these? Or: Why are some units false?
2
votes
2answers
243 views

How can I print a length in centimeters in VTEX?

\documentclass{article} \begin{document} \newdimen\mylength \mylength=1in \the\mylength \end{document} Output is: 72.27 pt But i want to show output in centimeter using VTeX.
2
votes
2answers
80 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. ...
2
votes
1answer
162 views

Resetting \parskip to 0pt “seems” to be ignored by \par

I was revisiting old code and rewriting things in what I thought was a more elegant manner, but I got unexpected results. I have the following code which seems to do exactly what I want it to do ...
2
votes
2answers
5k views

\leftskip, \linewidth and minipage

I have an environment with a minipageof the length \linewidth-\parindent (using the calc package). When I stick this in a place where \leftskip=\parindent it protrudes in the margin. Shouldn't \...
2
votes
1answer
48 views

What units are \pgfphysicalheight and \pgfphysicalwidth defined in?

I often use \pgfphysicalheight and \pgfphysicalwidth from the pgfpages package to define sizes dynamically based on the dimensions of my page (which vary). For example, here's a "dynamic" vertical ...
2
votes
1answer
434 views

\settolength issue

I want a horizontal length to have the same length as the word "physique". This is what I have tried: \documentclass{article} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage[...
2
votes
1answer
48 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{\...
2
votes
1answer
74 views

Printing all predefined variables and or values

So, whenever you begin a document by giving it some class (article, memoir, etc), there are many default lengths and heights being used. What I am looking for is a way to see these without explicitly ...
2
votes
2answers
336 views

Math operations on lengths

I have a table with three columns and I want the table to be distributed on \textwidth of the page. I tried: \documentclass{article} \usepackage{tabularx} \begin{document} \begin{tabularx}{\...
2
votes
2answers
601 views

Make a variable length horizontal rule depending on the text width of the title

I have the following custom environment for examples: \documentclass{article} \usepackage{lipsum} \usepackage{amsmath, mathtools, amsthm} \usepackage{graphicx, xcolor} \usepackage[top=1in, bottom=...
2
votes
1answer
403 views

Change \topsep in a list without packages

Consider this code \documentclass{article} \usepackage{lipsum} \begin{document} \setlength{\topsep}{3\baselineskip} %\setlength{\partopsep}{3\baselineskip} \hrulefill \begin{enumerate} \itemsep=...
2
votes
1answer
252 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 in ...
2
votes
1answer
647 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
162 views

Why is \glueexpr used in etoolbox's \deflength instead of \dimexpr

Consider the following snippet from etoolbox: \newrobustcmd*{\deflength}[2]{% \ifundef{#1} {\etb@noglobal\etb@err@nolen{#1}}% {#1\glueexpr#2\relax}} Maybe I do not understand the ...
2
votes
1answer
218 views

Why are the skip lengths ignored in align?

I created a new command \mathloose that stretches the spacing in an equation by suitably adjusting \thinmuskip \medmuskip and \thickmuskip lengths. The command works just fine in \[ \] and \( \) but ...
2
votes
1answer
325 views

Measure distance from text to bottom margin

I'm making some boxes for providing answers. The box macro takes the height of the box as an argument. I need to measure the remaining space from the line the box starts at, to the bottom of the page. ...
2
votes
1answer
707 views

Different behavior of setlength and settowidth

In this example, I would expect all "MMM" to be well-aligned to each other. But they aren't: \documentclass{article}% \usepackage{amsmath}% \newcommand{\before}{mmm}% \newcommand{\after}{MMM}% \...
2
votes
1answer
115 views

Store a ratio value in command and then use it to recalculate a length?

I want to store a ratio value in a command, e.g. \newcommand{\ratio}{0.7}, and then use it in recalculating a length, e.g. \setlength{\somelength}{\ratio*\width}. Using lengths to store the ratio ...
2
votes
1answer
189 views

Convert from float to length

I am using \pst@divide to divide a length in half \setlength{\RLEN}{4cm} \addlength{\RLEN}{\OFFSET} \pst@divide{\RLEN}{2cm}\RLEN ... \setlength{\DIST}{2cm} \addlength{\DIST}{\RLEN} % does not work. ...
2
votes
2answers
37 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: ...
2
votes
2answers
61 views

Explicit artihmetic functions as alternative to calc

Is there a way to perform compile time arithmetic with explicit functions that respect dimensions? Here is a strawman example of arithmetic functions: \mul{4}{7} % expands to 28 \mul{4}{...
2
votes
1answer
109 views

\paperwidth too large

Recently a fellow student asked me how to make a table over the entire width of the page. I don't know why he wanted to do that but I thought it should be easy and wrote the following example: \...
2
votes
1answer
87 views

Get pseudo-length value in scrlttr2

I am customizing a scrlttr2 template. I'd like to use some pseudo-length values to define other ones. For example, I defined \@setplength{firstheadhpos}{2.10cm} and I'd like to define the pseudo-...
2
votes
2answers
487 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}%...
2
votes
3answers
1k 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*{\...
2
votes
1answer
176 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\...
2
votes
1answer
3k views

newlfm package missing documented \greettoskipbefore command

While writing a letter using newlfm, I tried using the \greettoskipbefore command from page 8 of the manual and I received an "undefined control sequence" error. Looking at the source, it looks like ...