Questions tagged [varwidth]

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.

Filter by
Sorted by
Tagged with
0
votes
1answer
26 views

Use varwidth with algorithm2e

I’m trying to draw a box around an algortihm2e construct, like this: I tried to use the varwidth package to get a box with the natural width of the content: \documentclass{article} \usepackage{...
1
vote
1answer
19 views

Possible incompatibility between varwidth and ocgcolorlinks (hyperref/ocgx2)

In the simple example below, a reference inside varwidth environment fails due to hyperref package loaded with option ocgcolorlinks. Ading ocgx2 (with the same option) makes this even worse. \...
2
votes
1answer
29 views

Using varwidth within an environment definition with minted

I'm trying to create a new environment which holds a centered code snippet using minted. Firstly I came across to a minipage package, however it needs the width specification. I just want it to be ...
1
vote
1answer
156 views

problem with varwidth package

I had a book that contains the varwidth package. Until now everything was OK, but finally this error appeared: Sorry, but "C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" did not ...
3
votes
2answers
75 views

Using \color in varwidth environment produces warning and does not work as intended

Trying to use color in a varwidth environment, I stumbled upon a warning from the varwidth package. Inspecting the issue and trying the same with \parbox and the minipage environment lead to the ...
4
votes
2answers
60 views

Restrict background color to varwidth's narrower width with adjustbox?

I want to wrap a frame, with background color, around each table, with its caption included within the frame. For the frame, I've adapted Martin Scharrer's answer to "Adding border around figure and ...
0
votes
0answers
21 views

Make it so that output is single “sheet” with unbounded width

The first line of my TeX document is \documentclass[varwidth=true, border=10pt]{standalone} The output generated is cropped to the width of the content, but it has a maximum width after which it ...
1
vote
1answer
250 views

Redefine \intertext and \shortintertext to measure their width

I am trying to measure the natural width of an align* (with the fleqn documentclass option) and have been told in the comments at Determine natural width of align*: varwidth uses \linewidth even ...
1
vote
0answers
46 views

Determine value of overfull amount

If I set content into a box that is not wide enough (0pt in the MWE below), I get an overfull mesage displayed in the console. Can I obtain the maximum value reported in the messages Overfull \hbox ...
3
votes
1answer
120 views

Determine natural width of align*: varwidth uses \linewidth even though display is correct

In an earlier question, align* in varwidth seems to ignore fleqn option, it appeared as if align* was not being properly handled by the varwidth environment. A "fix" was provided which results in the ...
3
votes
1answer
83 views

align* in varwidth seems to ignore fleqn option

I am using the \documentclass option [fleqn] (which I think is identical to \usepackage[fleqn]{amsmath}). This seems to work fine, except when using an align* within the varwidth environment: Notes: ...
2
votes
1answer
178 views

Pseudo-code with algorithmic. Escape and indent a function using varwidth and parbox

I'm using the algorithmic package to create pseudo-code for my document. One of the algorithms has a few lines that are too long and they go too far to the edge of the page so I wanted to add a ...
1
vote
2answers
102 views

Vertical padding for multiline cells using varwidth

To set a maximum column width, I use varwidth as suggested by this answer. However, the vertical padding is only correct for single line cells, and is too little for multiline ones. Minimal example: \...
1
vote
1answer
228 views

standalone varwidth option breaks subcaption

I'm trying to generate a figure that is 19.05cm wide (according to submission specifications). I'm defining the width of the standalone document using the varwidth. I'm also using the subcaption ...
1
vote
1answer
50 views

Scaling a PDF page to fit a logic puzzle

I am trying to create a big logic puzzle using the logicpuzzle package. I want the resulting PDF page to fit the whole logic puzzle. I have tried using the standalone document class, but the puzzle is ...
0
votes
2answers
118 views

Page-unbreakable centered itemized list

I am trying to write new environment that would centre an itemised list, and here is the code for it: \usepackage{varwidth} \usepackage{enumitem} \newenvironment{mitemize}{ \begin{minipage}{1\...
13
votes
3answers
961 views

TeX \newcommand and D.R.Y. (don't repeat yourself)

My goal is to create a list within a varwidth, and alternate the colors of each item. At the time, the best I could do is this: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{...
1
vote
0answers
84 views

System equation and varwidth [closed]

I have two question: How can I left-align the equation system? How can I middle-align (vertical) the item bullet? \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{...
1
vote
1answer
120 views

`gather` Environment Does Not Work with `minipage`

I have been using minipage environment with displayed equation environments align* and gather*. The align* environment works fine with minipage but does not work well with varwidth. Code1: \...
0
votes
1answer
980 views

Set varwidth to column width with multicol package

I'm using two columns with the multicol package. I have some text that I put inside a \colorbox as below, and I use varwidth to make it include line breaks. If the lines are short, the box width ...
1
vote
1answer
220 views

Align-top varwidth

There's a way to align-top an array of warwidth placed side by side? \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[italian]{babel} \usepackage[ a4paper, ...
1
vote
2answers
170 views

standalone class would not crop AMS equations properly (left and top margin space remains)

I have the following simple code that I thought would output the AMS "gather" equation properly cropped at all sides up to the point where an imaginary straight line drawn at each side would touch the ...
1
vote
0answers
144 views

Detect width of minipage environment

I am using the following setup to add comments to the right of aligned equations. \documentclass{amsart} \usepackage{lipsum} \newcommand{\comment}[1]{\text{\footnotesize{#1}}} \newcommand{\blurb}[2]{...
2
votes
2answers
496 views

Tabular individual vertical alignment in header row with varwidth columns

How can i bottom align the header row only? Is there a way to do it with \rowstyle or something similar as i did to make the whole row \bf? I would prefer not to use multiple tabulars. (\...
3
votes
0answers
110 views

Centering list issue with Enumerate+Hyperref+Varwidth

I want to center an enumerated list so i've tried to use the answer of this question given by the Great David Carlisle. But using hyperref, varwidth and enumerate (in any order in the preamble) cause ...
2
votes
1answer
169 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
222 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} \usepackage[...
5
votes
1answer
307 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
174 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: \documentclass{...
1
vote
2answers
884 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 ...
3
votes
1answer
470 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 ...
7
votes
1answer
145 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
246 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
2k 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
252 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 ...
6
votes
2answers
765 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
4k 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} ...
5
votes
1answer
141 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 ...
2
votes
2answers
1k 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} \usepackage{...
1
vote
1answer
446 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
101 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 the ...
13
votes
1answer
5k 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} \usepackage{...
29
votes
1answer
2k 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
240 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 ...
2
votes
1answer
6k 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 ...
14
votes
2answers
26k 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 ...
27
votes
2answers
16k 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 ...