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
1 answer
36 views

Justification of header text

I want my long header text to be justified. In the picture below: I have inserted a red line such that I want all the text to be on the right side of that line (justification). How do I achieve that? ...
user avatar
  • 402
0 votes
0 answers
30 views

Warnings from footnotes within tcolorbox with varwidth

I'm getting various warnings when adding footnotes within tcolorbox with a varwidth, and even though the file compiles fine, i'd like to understand the reasons behind these. From Overleaf: Argument of ...
user avatar
2 votes
2 answers
62 views

Vertical alignment within tcolorbox using varwidth

I'm using tcolorbox to have a "warning" box. I'd like the "warning sign" to be at the very top of it, but it's not achieved even by using the [t] option of the varwidthenvironment. ...
user avatar
2 votes
2 answers
52 views

How to increase space between text and the line-box when using NiceTabular environment in the nicematrix package?

When using the NiceTabular environment in the nicematrix package, how do I increase the space between the text and the tikz-drawn line-box on all sides of the text when using type V columns defined by ...
user avatar
0 votes
0 answers
43 views

Adjusting tcolorbox according to both text width and title width

So, thanks to all the wonderful posts here, I was able to get tcolorbox to mostly do what I want it to do. However, one thing is still giving me trouble. I want the boxes to size automatically to the ...
user avatar
  • 203
1 vote
1 answer
47 views

breakable box with varwidth

PROBLEM Build an environment to put some text in some boxes that should be both breakable across a page and adapt to text width. Unfortunately, packages mdframed and tcolorboxes have the first option, ...
user avatar
  • 217
1 vote
1 answer
99 views

Hyperref package affects enumerate inside varwidth

In the following example, why does hyperref package affect enumerate (but not itemize) inside varwidth environment? Is it a bug? \documentclass{article} \usepackage{varwidth} \usepackage{hyperref} % ...
user avatar
  • 8,823
0 votes
0 answers
26 views

Tabto introduces vertical space inside varwidth

Using the newest packages in TeX Live, the \tabto command introduces a slight vertical space when used inside a varwidth environment. Consider the following MWE: \documentclass{article} \usepackage{...
user avatar
4 votes
1 answer
115 views

Newest Tex Live Updates introduce vertical space above varwidth

After updating all packages in Tex Live to the newest version, I have issues with the spacing produced by varwidth. Consider the following example: \documentclass[a4paper]{article} \usepackage{...
user avatar
2 votes
1 answer
78 views

Change margins for tcolorbox with varwidth environment

In the code posted below, I am using varwidth to shrink my tcolorbox to the text width for short text lines. However, I also have some wraparound text lines and the tcolorbox is too big in that case. ...
user avatar
0 votes
1 answer
33 views

If statement based on varwidth

I am producing a document with different widths using the varwidth package. While writing the content, I only work with one width at the time. For final production, the content is copied and pasted ...
user avatar
  • 601
1 vote
1 answer
817 views

How to enumerate with two columns inside a box?

I'm trying to figure out how to insert a enumerated list with two columns inside a box with minimal waste of space. The code outputs the first items of each column unaligned among themselves and ...
user avatar
1 vote
0 answers
77 views

Autowidth Box for Itemize Environment

A newenvironment is defined using varwidth and tikz to get a block of width equal to that of the content within it. It works fine, unless itemization is involved. A MWE is given here. \documentclass[]...
user avatar
  • 984
0 votes
1 answer
156 views

Extra white border with varwidth (standalone)

When I use the following code to generate two colored boxes: \documentclass[border={0pt 0pt 0pt 0pt}]{standalone} % left bottom right top \usepackage{varwidth} \usepackage{xcolor} \usepackage[xparse]{...
user avatar
  • 147
2 votes
2 answers
133 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{...
user avatar
2 votes
1 answer
68 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. \...
user avatar
  • 988
2 votes
1 answer
62 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 ...
user avatar
  • 123
1 vote
1 answer
739 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 ...
user avatar
5 votes
2 answers
524 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 ...
user avatar
  • 3,980
4 votes
2 answers
178 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 ...
user avatar
0 votes
0 answers
32 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 ...
user avatar
  • 161
1 vote
1 answer
497 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 ...
user avatar
1 vote
0 answers
68 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 (...
user avatar
3 votes
1 answer
297 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 ...
user avatar
3 votes
1 answer
137 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: ...
user avatar
2 votes
1 answer
411 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 ...
user avatar
  • 333
3 votes
3 answers
269 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: \...
user avatar
2 votes
1 answer
482 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 ...
user avatar
  • 197
1 vote
1 answer
65 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 ...
user avatar
  • 271
0 votes
2 answers
185 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\...
user avatar
  • 1
13 votes
3 answers
1k 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]{...
user avatar
1 vote
0 answers
137 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]{...
user avatar
1 vote
1 answer
201 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: \...
user avatar
  • 321
0 votes
1 answer
3k 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 ...
user avatar
  • 103
1 vote
1 answer
380 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, ...
user avatar
  • 1,301
4 votes
2 answers
459 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 ...
user avatar
  • 501
1 vote
0 answers
175 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]{...
user avatar
2 votes
3 answers
736 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. (\...
user avatar
  • 77
4 votes
0 answers
160 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 ...
user avatar
  • 73
2 votes
1 answer
233 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, ...
user avatar
7 votes
1 answer
329 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[...
user avatar
6 votes
1 answer
455 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} \...
user avatar
  • 1,899
5 votes
2 answers
204 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{...
user avatar
  • 1,899
1 vote
2 answers
1k 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 ...
user avatar
  • 1,163
3 votes
1 answer
704 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 ...
user avatar
7 votes
1 answer
170 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} \...
user avatar
  • 4,164
6 votes
1 answer
398 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 ...
user avatar
  • 163
7 votes
3 answers
3k 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 ...
user avatar
2 votes
3 answers
377 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 ...
user avatar
  • 297
7 votes
3 answers
1k 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 ...
user avatar
  • 1,482