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.
51
questions
0
votes
1answer
23 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 ...
1
vote
1answer
104 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 ...
1
vote
0answers
48 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[]...
0
votes
1answer
76 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]{...
2
votes
2answers
94 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{...
2
votes
1answer
57 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
41 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
456 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
243 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
103 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
27 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
400 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
59 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
219 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
113 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
296 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 ...
2
votes
2answers
194 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:
\...
2
votes
1answer
379 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
61 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
158 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
996 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
114 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
166 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
2k 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
301 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,
...
4
votes
2answers
324 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
166 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
607 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
127 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
212 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, ...
7
votes
1answer
289 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[...
6
votes
1answer
392 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}
\...
5
votes
2answers
194 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
972 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
596 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
160 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
315 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
328 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
969 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
153 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
497 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
105 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 ...
14
votes
1answer
6k 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{...
31
votes
1answer
3k 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
307 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 ...
3
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 ...
15
votes
2answers
28k 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 ...