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

4
votes
2answers
42 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
184 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
85 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
1answer
98 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
106 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
50 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 ...
4
votes
1answer
389 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
504 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
99 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
9k 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 ...