Skip to main content
Share Your Experience: Take the 2024 Developer Survey
115 votes
Accepted

My table doesn't fit; what are my options?

Let's first identify what we're referring to when we use the term "table". The typical table environment is a float, and can contain anything: a paragraph of text, an image, or even a ...
Werner's user avatar
  • 605k
32 votes
Accepted

Draw TikZ circles with a specific outer radius

in tikz any coordinate of any path command is determined for the infinitely thin lines. the real lines lie over them so that their centers matches. line width of real lines is accessible with length \...
Zarko's user avatar
  • 298k
24 votes

How to know the column width of a two column article?

The column width is stored in the length \columnwidth. It's value can be turned into a text representation using \the\columnwidth. Either use this inside \message{...} to print it to the LaTeX ...
Martin Scharrer's user avatar
19 votes
Accepted

How to take figure width=\linewidth OR height=\pageheight?

Just let the graphicx package have its way: \documentclass{article} \usepackage{graphicx} \usepackage[showframe]{geometry} %just to visualise the boarder \begin{document} \noindent\includegraphics[...
samcarter_is_at_topanswers.xyz's user avatar
18 votes

Width of the caption of a figure

Instead of using a predetermined width, one can measure the width using a savebox and put the caption inside a minipage. \documentclass{article} \usepackage{graphicx} \usepackage{blindtext} \begin{...
John Kormylo's user avatar
  • 80.6k
15 votes

How to create fixed width table columns with text raggedright/centered/raggedleft?

It’s easy peasy to specify the horizontal and vertical alignment of table cells at the same time with tblr environment of the new LaTeX3 package tabularray: \documentclass{article} \usepackage{...
L.J.R.'s user avatar
  • 11.1k
13 votes

How to create fixed width table columns with text raggedright/centered/raggedleft?

I found a very different technique that also works: With the package ragged2e you can issue the command \RaggedRight outside the tabular environment and get ragged right inside p- or m-columns of a ...
Sir Cornflakes's user avatar
13 votes

Fraction of \textwidth as image width

Informally, length calculation are done using factor multiplication as there is no division notation. Since any division can be represented as some multiplication, this shouldn't be a problem. So, .5\...
Werner's user avatar
  • 605k
12 votes
Accepted

tabularx with different column widths

I suppose you want the m column type width should be 40 % of the b type width, and the s type width half the m type width. The way you calculated the coefficients is not correct: the sum of the ...
Bernard's user avatar
  • 272k
11 votes
Accepted

How to have a node's width match another's height?

You can use fit library to compute node's height. But with fitting nodes, it's better to add its contents with the label option. Following code defines a barstyle style with two arguments, the first ...
Ignasi's user avatar
  • 137k
11 votes
Accepted

Adjust width of algorithm float

The algorithm float is defined using float's \newfloat. As a result, the entire float is consumed for possible restructuring (including the placement of the \caption, which depends on the style). This ...
Werner's user avatar
  • 605k
11 votes
Accepted

How to make \cdot operator same width as / (division slash) operator and vice versa

You can use a \makebox to create a box as wide as the slash: Code: \documentclass{article} \usepackage{amsmath} \usepackage{calc} \newcommand*{\mycdot}{\makebox[\widthof{/}]{$\cdot$}} \newcommand*{\...
Peter Grill's user avatar
11 votes
Accepted

TikZ: How to set width of complicated TikZ-image to \textwidth?

If your image is wider than \textwidth you'll have to work on it to adjust it to desired width. This solution won't change any image dimension (width, height, font size) unless you do it. Another ...
Ignasi's user avatar
  • 137k
11 votes
Accepted

LaTeX - how to detect scale of \includegraphics

If you specify both height and width keys, and specify keepaspectratio then the values are taken as upper bounds and the image is scaled so that both height and width fit within the specified areas, ...
David Carlisle's user avatar
11 votes

Auto width tcolorbox around equation

From this excellent macro of Thomas F. Sturm: ....fit the width...., here there is my adapt answer: \documentclass[11pt]{article} \usepackage[many]{tcolorbox} \tcbset{longtitle/.style={% title={#1},...
Sebastiano's user avatar
  • 55.7k
11 votes
Accepted

How to calculate the total width of a (tabularray) table and pass this length to other packages such tikz or tcolorbox?

You could use the \settowidth macro to measure the width of your table. To avoid having to code the table twice, you could use a savebox and use it once to typeset your table and another time to ...
samcarter_is_at_topanswers.xyz's user avatar
10 votes

Table exceeds the page width

The table is much too wide for a normal portrait page. Therefore the following example rotates it via environment sidewaystable of package rotating. The width of the table is still too large, ...
Heiko Oberdiek's user avatar
10 votes
Accepted

What unit of measurement is \widthof using

When you do \documentclass[11pt]{article} \newlength{\mylen} \newcounter{a} \begin{document} \settowidth{\mylen}{asdasd} \the\mylen \setlength{\mylen}{\widthof{asdasd}} \the\mylen \end{...
egreg's user avatar
  • 1.1m
10 votes
Accepted

Fitting tikz picture to textwidth

You can use the adjustbox package to scale any content: \usepackage{adjustbox} \begin{adjustbox}{width=\textwidth} \begin{tikzpicture}[....] ... \end{tikzpicture} \end{adjustbox} This scales the ...
Martin Scharrer's user avatar
10 votes
Accepted

Auto width tcolorbox around equation

A different approach by defining a new key autowidth title that lets the minimum text width to be equal to the the title length \documentclass[11pt]{article} \usepackage[many]{tcolorbox} \pgfkeysdef{...
Hafid Boukhoulda's user avatar
9 votes
Accepted

How to do \widthof with a symbol

You could use \widthof{$\equiv$} but there's a slicker way with mathtools: \documentclass{article} \usepackage{amsmath,mathtools} \begin{document} \begin{align*} c_s &\equiv b_s^2\\ &\...
egreg's user avatar
  • 1.1m
9 votes
Accepted

Limit tcolorbox to the width of the page

In your question you already talk about \linewidth -- just use it instead of \textwidth: \documentclass[12pt]{article} % %%% % Packages % %%% \usepackage[utf8]{inputenc} \usepackage[showframe]{...
samcarter_is_at_topanswers.xyz's user avatar
9 votes

TikZ: How to set width of complicated TikZ-image to \textwidth?

First of all, you have some unwanted spaces before and after your picture. This is what causes the extra distances to the right and left between the \fboxes. I have removed the empty rows (most of ...
StefanH's user avatar
  • 13.9k
9 votes

Tikzpicture match box width and column width

An easier solution would be to use tcolorbox. It's default size is always adjusted to \linewidth. \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{lipsum} \usepackage[french]{babel} \...
Ignasi's user avatar
  • 137k
9 votes

Are the widths of 𝐿, 𝑌, and 𝑍 in TeX Gyre Termes Math really equal?

Yes and no. The three characters have the same advance width 556. If we only look at that, the orange boxes below, we see (here the characters are squeezed together to make it more clear that the ...
mickep's user avatar
  • 9,060
9 votes

Undefined control sequence setting PDF geometry

In luatex the names of the commands are \pageheight and \pagewidth. Typically the best is to load a package like geometry or graphics which will set the PDF mediabox automatically to the values of \...
Ulrike Fischer's user avatar
8 votes

How to have a node's width match another's height?

And, just for fun, a method using the let syntax from the calc library. \documentclass{article} \usepackage{tikz} \usepackage{varwidth} \usetikzlibrary{positioning,shapes,calc} \begin{document} \...
Torbjørn T.'s user avatar
8 votes

Table exceeds the page width

Assuming your document uses a "normal" paper size (A4 or US letter), "normal" page margin (say, 1 inch), and font size of 10pt, it is possible (though only just) to make the table fit inside the text ...
Mico's user avatar
  • 511k
8 votes

Resizing or scaling table only if it is larger than column width

\resizebox makes the dimensions of the box to be scaled available as \width, \height, and \depth. This can be used to only scale the box, if it is wider than the column width. \documentclass[10pt]{...
Heiko Oberdiek's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible