{boxes} are the units used by (La)TeX to construct a page by pasting them together horizontally or vertically. A single character from a font is a box, as are the lines of type and the eventual page.

learn more… | top users | synonyms

233
votes
7answers
55k views

Remove ugly borders around clickable cross-references and hyperlinks

I know that I can use hyperref to make cross-references and hyperlinks clickable. That makes the clickable areas outlined in fluorescent green, however. How can I make the green boxes go away?
104
votes
1answer
16k views

What are the different kinds of boxes in (La)TeX?

I've seen hbox, vbox, mbox, parbox and others used in various code samples. What are the different kinds of box in (La)Tex? Which are suitable for use in LaTeX, as opposed to plain TeX?
62
votes
2answers
21k views

What does “overfull hbox” mean?

I often see output from TeX with the warning overfull hbox, badness 10000. What does this message mean?
61
votes
3answers
24k views

What are underfull hboxes and vboxes and how can I get rid of them?

Often, TeX outputs underfull hbox and vbox warnings when running and in the generated log file. What are these and how can I get rid of them?
56
votes
4answers
2k views

How can I visualize boxes?

This question led to a new package: lua-visual-debug Some of you may know the Web Developer Toolbar for Firefox that can outline the block level elements of a page like this: Is there a way to ...
49
votes
5answers
2k views

Is there no easier way to float objects and set margins?

I come from a HTML / CSS background and am used to a particular way of setting margins, floats, etc. As a beginner in TeX, I am having a hard time positioning elements, probably because my mindset is ...
38
votes
3answers
5k views

How to create Highlight Boxes in LaTeX?

I am writing an Article in LaTeX. Please suggest me how to create a highlight boxes like the ones shown below in LaTeX:
38
votes
3answers
2k views

Bounding box for each letter

How can I take input text and replace each character with a solid (and/or hollow) rectangle representing the bounding box for that character? In the case where two characters are closer together from ...
38
votes
3answers
16k views

\parbox vs. minipage: Differences in applicability

Lamport, LaTeX: A document preparation system, states on p. 104: There are two ways to make a parbox at a given point in the text: with the \parbox command and the minipage environment. They can ...
36
votes
1answer
4k views

\setbox vs. \sbox and \savebox - What are the differences I need to know about?

What's the difference between using TeX's \setbox and LaTeX's \sbox and \savebox?
33
votes
2answers
3k views

How to keep a constant baselineskip when using minipages (or \parboxes)?

When a minipage is used to box a text paragraph, the first line of the minipaged text and the last line of the previous text paragraph are closer than two consecutive lines in a standard text ...
32
votes
1answer
6k views

Function and usage of \leavevmode

I am beginner of LaTeX. From many examples I found, I notice that it's very common to use command \leavevmode. I can't find any information about this command. Could anyone tell me what's the function ...
29
votes
5answers
2k views

Confused with TeX terminology: height, depth, width

The LaTeX reference card states for example \strut box w/ ht and depth of “(”, zero width I came to see text as a two dimensional feature, but I must be missing out on something... (following ...
29
votes
1answer
2k views

Definition of \strut explained

Can anyone explain me the fine details of the \strut macro. Why is the box \copyied in mathmode but \unhcopyied otherwise? % latex.ltx, line 484, but identical in plainTeX ...
28
votes
3answers
9k views

How to highlight an entire paragraph?

I'd like to highlight paragraphs such that the highlight color appears as one whole rectangle underlying the entire paragraph. I have looked around but nothing gives me the desired effect so far. For ...
28
votes
4answers
2k views

Fit text into given box by adjusting the fontsize

I would like to fit text (potentially several paragraphs) into a box of given size. This should be done by adjusting the fontsize of the contained text. Clarification edit: The given dimensions are ...
27
votes
2answers
4k views

How to rotate a box in-place

The following LaTeX code illustrates my question. Is it possible to get what I want without doing the negative \hskip, as I want a simple generic solution which will rotate the box to any angle ...
25
votes
2answers
619 views

How good a juggler is TeX?

I recently made an adaptation of pgfpages which allows one to gather in several typeset pages and then lay them out in some layout over several physical pages (the original pgfpages only allows one ...
24
votes
4answers
5k views

Faded drop-shadow using tikz-based rounded rectangle?

Background Epigraphs are in a box with rounded corners. The boxes have a drop-shadow. Example Picture #1 shows a shadow, while Picture #2 shows a shadow that fades out (soft blur): Problem ...
23
votes
3answers
380 views

What are the ways to position things absolutely on the page?

I know that there is tikz, but also eso-pic and textpos. I'd like to see a list of possible ways (not necessarily packages) for absolute positioning of things (which I believe amounts to "boxes") on ...
22
votes
2answers
8k views

What's the difference between \strut, \mathstrut and \vphantom?

What's the difference between \strut, \mathstrut and \vphantom? When would I prefer one of them to the others, and why?
21
votes
1answer
594 views

Box that behaves like vbox but its width is that of its content?

I need a box that fulfils these conditions: It can contain multiple lines (and paragraphs) of text (unlike \hbox) A line that is longer then \textwidth is split to the next line (like \parbox, \vbox ...
20
votes
2answers
31k views

Attractive Boxed Equations

I often used \boxed{...} from the AMS math package to place a box around important equations. However, this approach often produces somewhat awkward looking output. Consider \documentclass{article} ...
19
votes
2answers
480 views

TikZ -The pretty boxes to frame the theorems-lemma-proposition-etc

I came across a website which provides examples of pretty boxes to frame theorems in LaTeX with extension bioboite and not with TikZ. Here is code with: \documentclass{article} ...
19
votes
3answers
719 views

How to clip a TeX box using low-level PS commands?

I like to clip an arbitrary TeX box (\hbox) but without using larger graphic related packages like PGF/TikZ or PSTricks. This is intended to be used in packages which should not force the user to also ...
19
votes
1answer
861 views

Caption parbox 6.0 pt too wide

For my listings, I use this caption setup: \usepackage{caption} \DeclareCaptionFont{white}{\color{white}} \DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}} ...
18
votes
2answers
10k views

Any way to center text within a \parbox?

Probably I'm missing something, but I'm really struggling to find an answer to this simple question: How to center text within a \parbox? Side note: I don't want to switch to any other environment ...
18
votes
2answers
5k views

Highlight an equation within an align environment

I would like to define a command that puts a red box around an equation with yellow highlighting. I have the basics working pretty well. What I am unable to figure out is: How to keep the alignment ...
18
votes
2answers
317 views

What is \box255?

I'm just reading the everyshi manual, and it says: This package provides the hooks \EveryShipout and \AtNextShipout whose arguments are executed after the output routine has constructed ...
17
votes
6answers
5k views

Text in squared box

I'd like to bot a square box around some text. I'd like to denote a labelled object of size 1, in combinatorics this is often symbolised by something like \boxed{1}. It would be nicer if the box was a ...
17
votes
4answers
4k views

Horizontal equivalent to \raisebox?

Is there a horizontal equivalent to \raisebox? I'd like to shift some content horizontally without altering the layout of surrounding content. Edit: I feel bad because my question wasn't precise ...
17
votes
1answer
2k views

What is the command to highlight bad boxes in pdf?

I seem to remember a command to show bad boxes in a PDF when using latex, but googling is not helping me to remember. How can I show bad boxes in my PDF?
17
votes
2answers
452 views

Non-invasive replacement for \fbox?

I am trying to create a macro that improves on \fbox by working correctly in all cases and by being minimally invasive with respect to padding. What I've got so far works fairly well, but I'm having ...
16
votes
4answers
4k views

How to construct a coloured box with rounded corners

Here is the specs of the box. Color of the bar rule should be: \definecolor{mycolor}{rgb}{0.122, 0.435, 0.698} Radius of the 4 corners of the box: 4pt Thick line = 0.5pt Text should be 6pt ...
16
votes
3answers
2k views

Color box with rounded corners around a fragment of a formula

Is there any way in TeX to highlight some part of a formula with a box having colored background and rounded corners? At present, I need to export such formulas into an image, add those highlight ...
16
votes
3answers
415 views

(Why) Can't we get 'fully expandable' versions of every command?

I'm just starting to figure out what 'expandable' means in LaTeX, and why it is useful to have commands that expand as far as possible. In particular: If you want to \typeout some string to the log ...
16
votes
1answer
3k views

Differentiating between \hbox and \mbox

What are the differences between \hbox and \mbox? Related: This answer to "What are the different kinds of boxes in (La)TeX?" discusses different boxes in general. This answer to "Difference ...
16
votes
3answers
695 views

Rounded box around placeholder text that supports line breaking

I want to draw a rounded box around a piece of text like that: The left and right borders should be half circles and line breaking should be supported. This my code so far: \setuppapersize[A7] ...
16
votes
2answers
697 views

Package for game/playing cards (not only poker)

Is there a package to design playing cards (NOT ONLY POKER and similar card games, but board games like this and that) in TeX (and friends)? I'm well aware of this one and a half years old topic ...
15
votes
4answers
425 views

Reasons for saving a box?

I've been reading through a number of answers that use \newsavebox to save the contents of a box. As far as I can tell it's a workaround for fragility of some kind. Is that right? If not, what is the ...
15
votes
3answers
2k views

Why doesn't \settoheight of \parbox work?

Consider the following code: \documentclass[a4paper]{letter} \usepackage{calc} \usepackage{printlen} \newsavebox{\foobox} \newlength{\fooboxheight} \savebox{\foobox}{ ...
15
votes
2answers
210 views

Write content of box to a file

I would like to take the contents of a box generated with \begin{lrbox} ... \end{lrbox} and write it to a file. The use case is a question and answer environment, where the answer should be collected ...
15
votes
3answers
410 views

Angle brackets with an underset arrow

I am trying to make a pair of angle brackets of variable height enclosing a main box along with a box beneath each bracket and an arrow of variable length between these lower boxes. Since I'm sure ...
15
votes
2answers
11k views

beamer style text box

If you're using beamer you can do some nice text boxes using: \begin{block}{block title}content of block\end{block} Which gives a text box something like this (the box with the header Esimerkki): ...
15
votes
2answers
1k views

Fitting text into a box over-a-pic

I am trying to fit a text into a box within an overpic environment. kongo09 had a similar question fit-text-into-given-box-by-adjusting-the-fontsize, and a highly workable solution was provided by ...
15
votes
1answer
212 views

Strange behaviour of \sbox

This question consists of two related parts. I already solved the original problem but still don't understand where it came from or why the solution works. I use the subcaption package so I can place ...
15
votes
1answer
9k views

How to draw frame with rounded corners around box

Is it possible to simply draw a frame around a box which has rounded corners, and be able to control frame width, frame color, frame radius, box background colour (preferably without having to use the ...
14
votes
5answers
7k views

How to draw a square of 1cm in LaTeX filled with color?

How to draw a square of 1cm in LaTeX filled with colour? I found mdframed and framebox does this, but there need to write text inside it. I just need to draw a box.
14
votes
6answers
1k views

How to stack boxes like a vertical version of \mbox?

I would like a vertical equivalent to \mbox{} that somehow takes a sequence of boxes and stacks them on top of each other. I'd like the resulting width to be the width of the widest box, and I'd like ...
14
votes
2answers
5k views

How to highlight important parts (with a gray background)

In the below link http://www.math.uiowa.edu/~goodman/algebrabook.dir/bookmt.pdf the author highlights anything which is important using a greyish color background. For example, if you see ...