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

2
votes
1answer
37 views

Microtype, raggedright and varwidth doesn't work well with each other

I am using microtype inside varwidth environment in the way described here. It works well with justified text, but now I have very short-lined text like a verse. And sometimes microtype is working, ...
6
votes
1answer
74 views

Microtype does not work inside varwidth

I make a template for different texts and I need to use varwidth. But it seems microtype doesn't work inside this environment. Is there any way to make it work? \documentclass{book} ...
5
votes
1answer
70 views

Combining varwidth with \hangindent

Looks like inside {varwidth} hangindent is applied to the right side of the paragraph, instead of the left side: \documentclass{article} \usepackage{varwidth} \usepackage{lipsum} \begin{document} ...
4
votes
2answers
62 views

Combining centering with \narrowragged

Package varwidth defines the command \narrowragged that allows us to have narrow paragraphs. It makes all the lines, including the last one, to have approximately the same length: ...
1
vote
2answers
265 views

2D and 3D Tikz pictures side-by-side

Previously I've had problems with 3D Tikz pictures having a lot of whitespace added to one side which was solved by using \documentclass[varwidth,border=5pt]{standalone}. Now, however, I'm trying to ...
4
votes
1answer
124 views

Follow-on to tabulary + longtable + captioning

I was able to use the coding provided by Justibus: Several caption problems in longtable and tabulary. What my question is - now that i've been able to make my table wrap columns and break over ...
8
votes
1answer
91 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
91 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
705 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
96 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 ...
5
votes
2answers
118 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
1k 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
112 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
310 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
139 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
66 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
1k 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} ...
23
votes
1answer
1k 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
136 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
4k 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 ...
12
votes
2answers
13k 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 ...
21
votes
2answers
7k 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 ...