A package that defines a {varwidth} environment (based on {minipage}) which is an analogue of {minipage}, but whose resulting width is the natural width of its contents.

learn more… | top users | synonyms

7
votes
0answers
38 views

Adding color package destroys listing centering

I am using @egreg's answer to make listings centered: \documentclass[a4paper]{book} \usepackage[T1]{fontenc} \usepackage[ hang, small, it, hypcap=true ]{caption} \usepackage{fancyvrb} ...
6
votes
1answer
47 views

Why is a varwidth incorrectly vertically centered by \raisebox{-0.5\height}?

I was creating a pseudocode/JavaScript comparison table, and wanted to typeset algorithms written with the algorithm2e package vertically centered in table cells. Out-of-the box, algorithm2e can't do ...
7
votes
3answers
225 views

Make box with minimum width (in math mode)

How can I give a box a minimal width, in math mode? That is, I would like a command something like \minwidth{exp}{width}, which will always typeset exp, but additionally, if the natural length of exp ...
2
votes
3answers
52 views

Imbricate Empheq

I am trying to imbricate empheq environments. The result (using array) I would like to obtain is : I do not like array environment because it does not manage the spaces well, as you may see. I ...
4
votes
2answers
68 views

Use varwidth to make a paragraph center in a table

The following code does what I want, except the V acts like the p option, but I want the m option. \documentclass[12pt]{memoir} \usepackage{varwidth} \begin{document} \begin{tabular}{lV{2in}}\hline ...
4
votes
2answers
430 views

Restricting the background color to an ovalbox

The snippet \documentclass[png,convert={density=600}]{standalone} \usepackage{times,fancybox,varwidth,color} \pagecolor{cyan} \cornersize{1} \begin{document} \ovalbox{\large Hello} \end{document} ...
6
votes
1answer
93 views

Paragraph with a given aspect ratio?

I using tikz together with package varwidth, I find myself playing out with different values for paragraph width, so as to achieve an "optimal" aspect ratio. Ideally, I would have liked to have an ...
3
votes
2answers
142 views

Caption package destroys center/varwidth

I have received a wonderful comment how to get listings centered: \documentclass[a4paper]{book} %\usepackage[hang,small,it,hypcap=true]{caption} % screw hypcap \usepackage[T1]{fontenc} ...
1
vote
1answer
114 views

minted Environment Inside varwidth Environment

Is there a way to incorporate a minted environment inside a varwidth environment? I have colored backgrounds for code snippets, and I did manage to put a minted environment inside a minipage, based on ...
1
vote
0answers
59 views

Line breaks not breaking using varwidth package for color background which is giving compilation error [closed]

When we are using varwidth package and the below macro \newcommand\MyCBox[1]{% \colorbox{red!60}{\begin{varwidth}{\dimexpr\linewidth-2\fboxsep}#1\end{varwidth}}} While compiling we are getting ...
5
votes
1answer
533 views

standalone: varwidth option limits output width?

It seems, that the varwidth option for the standalone class limits the output width. The problem is produced in the following example: \documentclass[10pt,crop,varwidth]{standalone} ...
21
votes
1answer
633 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 ...
5
votes
2answers
111 views

Vertical spacing of text changes in a macro depending on input

I defined a keynote macro to insert key ideas in my document using varwidth. The document is in \doublespacing and I have defined \singlespacing inside my macro. However, the correct spacing is ...
1
vote
1answer
3k views

Top-align text in a TikZ node of given size for single- and multiline case

I would like to set text in a TikZ node of maximum width and minimum height, i.e. the node cannot grow horizontally (but shrink for short text) but it can grow vertically (if the text exceeds the ...
11
votes
1answer
11k views

Align minipage to baseline of first or last line inside minipage?

The minipage environment has options for making the top, bottom, or center of the minipage box line up with the baseline of the surrounding text. Is there a way to make it line up to the baseline of ...
18
votes
2answers
5k views

How do I set a maximum column width?

My problem is that I have many tables in my document with the same layout, and I want to specify the maximum width of a specific column to be 5 cm. I tried with p{5cm} but it make the column fix 5 cm ...