{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

10
votes
1answer
5k views

Relative padding of a minipage's paragraph

Background Created a custom command for rendering quotations (epigraphs). Problem The text in the following image has no space at the border: The word "and" is flush with the right margin. Code ...
10
votes
1answer
215 views

How do I get an empty box on each page?

I'd like to have an empty box on the bottom of my pages in a certain chapter. I've messed around with wrapfigure and kinda sorta gotten something that looks okay, but I'd like to do it properly so I ...
9
votes
3answers
547 views

Align text on top of a framebox

I am trying to create a series of boxes so that my students can input there id number for there final exam. \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \newsavebox{\idbox} ...
9
votes
3answers
5k views

How to box verbatim to prevent page break?

If I try \mbox{ \begin{verbatim} Some looooong text... \end{verbatim} } Then some compilation errors occur.
9
votes
2answers
3k views

Create empty box sized according to imaginary content

In LaTeX, is it possible to create an empty box that has exactly the dimensions of some content given? Example: \emptybox{abc} would insert an empty box of the size as if "abc" was printed there.
9
votes
2answers
414 views

Framed box, over framed text with image

Hi all, I'm a newby in LaTeX but after researching online, I have seen that it is possible to create boxes and frames adjusted to text and images. I am trying to achieve something like the image, ...
9
votes
3answers
143 views

Box with adaptive length

When I want to put formulas into boxes, I like the box to adapt to the length of my formula. For example, I don't want to put $1+1=2$ in a very large box. To address this, I use the command \encadrer ...
9
votes
3answers
4k views

A version of colorbox that works inside math environments

I'd like to highlight particular parts of an amsmath environment. Here's a minimal working example: \documentclass{article} \usepackage{amsmath,color} \newcommand{\abs}[1]{\lvert#1\rvert} ...
9
votes
5answers
1k views

\newenvironment issues with environment comment

I am trying to setup the formatting for a LaTeX document (it's got the class memoir), so that it would be fairly simple to add to it in the future. Two of the features I'd like are: Be able to mark ...
9
votes
2answers
618 views

Why do I need a '\vspace{0pt}` to align a table and a figure along the bottom line when using '\vbox' and '\hbox'?

Recently, I fiddled with placing a table and a figure next to each other such that their bottom parts aligned with each other. I managed to do by using \vbox and \hbox, but there is one thing that ...
9
votes
2answers
896 views

How to avoid underfull vbox in combination with \vsplit?

In the following example I am using the command \vsplit. I can't see the reason why \vsplit produced an overfull \vbox \documentclass{article} \parindent0pt \def\exampletext{Text Text Text Text Text ...
9
votes
6answers
4k views

Dashed box environment

I am new to LaTeX and I'm having a hard time trying to create a dashed box environment without success. Can someone please share a code for a dashed box environment such as the one in the image? I ...
9
votes
2answers
551 views

Beamer: content in box register does not survive \end{frame}

Consider the following example (I edited the example to include LaTeX lrbox environment): \documentclass{beamer} \newsavebox\mybox \newsavebox\myboxb \begin{document} \frame{ \sbox\mybox{Hello ...
9
votes
2answers
1k views

Adjust font size on-the-fly

In my document I want to emphasize some key points by placing them in a box with rounded corners. This I do using the following code: \documentclass{report} \usepackage{fancybox} \begin{document} ...
9
votes
4answers
6k views

Colored box in new environment

I have a problem, I'm fairly new to LaTeX but I think I got the basics. My problem is that wants to create a environment that can create a minipage with a background color and some text in it. I can ...
9
votes
3answers
187 views

How can I wrap each page of a document with a box that has a caption?

I have a LaTeX document that contains proprietary information. I need to print a version of the document that has a box around the text with a disclaimer (something to the effect of "Proprietary ...
9
votes
1answer
2k views

Text in subscript

For my text-in-mathmode needs in LaTeX, I use \mbox. However, it does not seem to behave well in subscripts. How can I write text that adjusts its height? $ 3 \mbox{dB} = f_{ 3 \mbox{dB} } $ ...
9
votes
1answer
653 views

How to create a 'fact box' or pull quote that is tied to the margins of your page?

I'd like to accomplish the following: Ut convallis libero in ------------------- urna ultrices accumsan. | | Donec sed odio eros. | "an important | Donec viverra mi quis ...
9
votes
2answers
1k views

How do I backcolor in verbatim?

I have some code I want to typeset as verbatim (lstlisting would be ok as well) - but I want to highlight some parts of it via a different background color, i.e. something like this: \begin{verbatim} ...
9
votes
2answers
3k views

How to continue the framed text box on multiple pages?

I am using framed package to create text boxes using begin{framed} and end{framed}. My problem is that my framed box goes on for two pages, and I don't want the text box to complete itself at the end ...
9
votes
1answer
91 views

\hbox_overlap_right:n{} vs. \makebox[0pt][l]{}

I stumbled about some, to my understanding, unexpected behaviour of the expl3 command \hbox_overlap_right:n. I was expecting all examples below to produce the same result, that is, the frame box ...
9
votes
2answers
1k views

Framed text with a float in it

I'd like to frame the text between \startfoo and \stopfoo, but there is a float in it. \documentclass{article} \begin{document} \startfoo \begin{figure}[h] some float with a \caption{...} ...
9
votes
1answer
133 views

Vertically align the top of a box to the top of the tallest box of a line

This is a follow-up question on this thread. I want to mark a line by putting a star to the left of it. If the line contains a box that is tall, the marker should be aligned with the top of this ...
9
votes
1answer
127 views

LaTeX2e \makebox !=\hbox?

The source2e documentation (pg. 233) when describing \makebox states: ... If wid  is missing, then pos is also missing and obj  is put in an \hbox of its natural width... This, ...
9
votes
1answer
6k views

How would I make a colored alert box in LaTeX?

I would like to make something similar to the following green alert box http://twitter.github.com/bootstrap/components.html#alerts I have tried various combinations of verbatim without success
9
votes
1answer
76 views

Measure a very large \vbox

I would like to measure the total height of a \vbox even for boxes which are larger than \maxdimen. It would be enough, if the code would compute the total height correctly only for small boxes. For ...
9
votes
1answer
137 views

\ref with tight box surrounding the reference

How can I make the colored box around a reference appear completely tight? MWE: \documentclass[a4paper,twoside,openright,final,12pt]{book} \usepackage{etex} \usepackage[english]{babel} ...
9
votes
1answer
734 views

Box or sidebar for additional text

I'm not sure of the name of what I need. I would like to set some text in a box or sidebar, as I've seen in some textbooks. The main text will refer the reader to the sidebar for more details. I would ...
8
votes
3answers
230 views

PDF annotations: How to know if “a box is empty”?

Extract from dvipdfmx documentation: Warning: No annotation will be constructed if the content between pdf:bann and pdf:eann is an empty box. My MWE (via xelatex): \documentclass{article} ...
8
votes
3answers
282 views

Listing background broken by \colorbox and \framebox

I am using listing environment (listings package) with the background parameter. I want to highlight some lines of code and I am using the \colorbox, \makebox and \framebox to achieve this. However, a ...
8
votes
5answers
2k views

Set \strut height

I'm using quite a few \colorbox and \colorfbox in a document but they weren't sitting at the same heights (because some words contained g and this seemed to push the box down. The solution I found ...
8
votes
3answers
184 views

box the size of A containing B

A thing I'd often like to do is put in my document a box the size of some text A and containing some other text B. For instance, I have two tikz nodes, one containing $n$ and one containing $n+1$, and ...
8
votes
2answers
2k views

Sample example of box in latex

Could someone make this picture in sample code in LaTeX and please make it in different style with different colors. Here is my attempt: \fbox{ \parbox{\linewidth}{ This example will show ...
8
votes
2answers
522 views

How can I insert a paragraph or image into the same spot on every page of a memoir doc?

How can I duplicate one feature of this layout from 'House of Leaves' in a 100ish-page book using LaTeX? (I'm presently using memoir for document formatting/structure.) The specific feature I want ...
8
votes
2answers
212 views

How to avoid the enlarging of a \vbox by \vbox\unvbox?

The \vbox{\unvbox ...} operation should remove obsolete vertical space. In the following case, additional vertical space appears somewhere inside the resulting box. The resulting \vbox grows from a ...
8
votes
2answers
990 views

Expandable Nested Boxes with TikZ

Could someone please post a minimal tikz example to draw this: I am currently doing this with nested tables, but would like to see how it can be done with tikz. The nodes would ideally have a ...
8
votes
2answers
160 views

Is it possible to remove (or otherwise nullify) a whatsit node from a box?

I am aware that it is not generally possible to modify the contents of a box (as per http://tex.stackexchange.com/a/49903/17427), though I believe it is sometimes possible to "unbox" material and hack ...
8
votes
1answer
249 views

Expansion of macros and box contents

I don't understand the following behavior. Intro First, here is a simplified version of a macro I am using (which is itself a hacked version of a macro found in gloss.tex). If you have a string ...
8
votes
2answers
3k views

Vertical spacing of framed environment

Here is an MWE that shows the problem: \documentclass{article} \usepackage{framed} \setlength{\FrameSep}{3pt} \setlength{\parindent}{0pt} \begin{document} \fbox{Foo} \fbox{Foo} \begin{framed} Foo ...
8
votes
2answers
2k views

Beamer overlay box around text - the correct way?

I have something that "works," but I'm wondering if there's a more elegant solution. I want to box some text after an itemize in beamer, so this is what I'm doing: \documentclass{beamer} ...
8
votes
3answers
479 views

How to make a thick line connect completely with the side of a box in TikZ?

In my figure, I have a thick line that connects with the side of a box. However, the line does not connect completely with the box. Also, the line covers part of the box (which I don't want). So, I ...
8
votes
2answers
193 views

Better way to center text below overline with given length

I need to create lines for signatures. I need 3 of them with different texts below them, but i want all lines to have the same length and the texts centered below them. Tables with \hlines made the ...
8
votes
2answers
121 views

\setbox containing maths interferes with surrounding math mode in XeTeX

I encountered what might be a bug in XeTeX (but I would be glad to be proven wrong) while chasing a strange interaction between bytefield, unicode-math, and mathtools. In general, I do not expect a ...
8
votes
1answer
196 views

Why isn't a zero-width box in math mode aligned on the baseline?

I'd like to move equation labels into the margin for an article I'm working on, and the answers in Theorem Name/Numbering in Margin accomplish exactly what I'm looking for. Here is a small example: ...
8
votes
1answer
374 views

Adding overfull hbox 'slugs' to final document version

I'm using a documentclass which looks dramatically different in draft mode compared to final. I'm preparing my document for the final formatting, so I don't want to pass the draft option. However I ...
8
votes
1answer
339 views

Curious effect with \newsavebox

The following code fails with the error ! LaTeX Error: Command \mybox already defined. Or name \end... illegal, see p.192 of the manual. despite the fact that \mybox has been ...
8
votes
3answers
116 views

Fixed text line height?

I have two minipages and the problem that the height of a text line depends on the characters I am using. How can I always have the same height for a text line in a minipage? I have used Tikz to ...
8
votes
1answer
102 views

Implement functionality equivalent to many thousand \savebox

I have a large (approx 600 pages) index of files, and for each file entry significant computation is required so that additional links can be added. The computation of these links takes quite a bit ...
8
votes
1answer
6k views

What is a “Overfull \hbox (9.89561pt too wide)”?

I have this warnings around, some of them seems to be solved naturally but I never really understand what do they mean. What this means? Edit: I would like to keep the question in more general ...
8
votes
1answer
879 views

Partially transparent text box

I am trying to make a poster using beamer. Can any one please reply me, my question is: How can I make my boxes partially transparent so that my background will be visible through the boxes?