# Tag Info

## Hot answers tagged width

97

Let's first identify what we're referring to when we use the term "table". The typical table environment is a float, and can contain anything: a paragraph of text, an image, or even a tabular. Working with the latter - a tabular - and how to adjust it is what is discussed here. The discussion also applies to array structures since they provide an math ...

53

The caption package provides a width parameter than can be set for each figure individually. This way you can adjust the width to suit the width of your figure: \documentclass{article} \usepackage[margin=1in]{geometry}% Just for this example \usepackage{lipsum}% Just for this example \usepackage{graphicx,caption} \begin{document} \begin{figure}[t] \...

31

in tikz any coordinate of any path command is determined for the infinitely thin lines. the real lines lie over them so that their centers matches. line width of real lines is accessible with length \pgflinewidth. knowing it, it is simple to correct size of some elementary shapes as are rectangles, squares and circles with considering line widths. for ...

29

I think you have two good choices and a (likely) dreadful choice: Use a tabular* environment, Use a tabularx environment (or its close cousin, tabulary) Use the basic tabular environment and scale it up (or down) using \resizebox. The results are as follows (the first horizontal line is there just to illustrate the width of the text block; the bodies of ...

28

Something like this? \documentclass{article} \newlength\stextwidth \newcommand\makesamewidth[3][c]{% \settowidth{\stextwidth}{#2}% \makebox[\stextwidth][#1]{#3}% } \begin{document} \fbox{\makesamewidth[c]{text to set width}{new text}} \end{document} If the order of arguments is important you can use xparse: \documentclass{article} \usepackage{xparse}...

26

Update Use \arrayrulewidth from the preamble and place it before the desired table using a group to keep the change to \arrayrulewidth local: \documentclass[11pt]{article} \usepackage{array} \begin{document} \begin{tabular}{|l|l|l|l|} \hline & & & \\ \hline & & & \\ \hline & & & \\ \hline & & &...

19

If you don't mind putting the variable-width text into a node, then it is relatively easy. You can adjust the spacing to your liking further. \documentclass{article} \usepackage{tikz,fancyhdr,lipsum} \usetikzlibrary{calc} \usepackage[includeheadfoot,margin=0.8cm]{geometry} \fancyhf{} \pagestyle{fancy} \rfoot{1 of 10} \definecolor{shadeleft}{RGB}{222,...

18

calc provides \widthof{<stuff>}: \documentclass{article} \usepackage{calc} \setlength{\parindent}{0pt}% Just for this example \begin{document} Here is some text that is lengthy.\par \makebox[\widthof{Here is some text that is lengthy}][l]{Left}\par \makebox[\widthof{Here is some text that is lengthy}][c]{Centre}\par \makebox[\widthof{Here is some text ...

15


11

If your image is wider than \textwidth you'll have to work on it to adjust it to desired width. This solution won't change any image dimension (width, height, font size) unless you do it. Another solution could be to use standalone class. In this case, you'll work on an independent file to produce the desired image and, later on, include it in your text ...

11

If you specify both height and width keys, and specify keepaspectratio then the values are taken as upper bounds and the image is scaled so that both height and width fit within the specified areas, so you need something like \includegraphics[width=\textwidth, height=.75\textheight,keepaspectratio]{..} if the caption takes .25\textheight

11

From this excellent macro of Thomas F. Sturm: ....fit the width...., here there is my adapt answer: \documentclass[11pt]{article} \usepackage[many]{tcolorbox} \tcbset{longtitle/.style={% title={#1}, before upper={\begin{tabular}{@{}l@{}l}\phantom{#1}\\[\the\dimexpr-\ht\strutbox-\dp\strutbox]}, after upper={\end{tabular}}} } \begin{document} \begin{...

10

It works fine for me, but you need to zoom in a lot to see the difference between very thin and thin (the latter is the default line width). Try setting the straight line to ultra thick to verify that it's working. To change the axis line style, use axis line style = ultra thick.

10

\makebox puts its contents into a box, whose dimensions are available as \width, \height, \depth inside the optional arguments of \makebox: \documentclass{article} \newcommand*{\minwidthbox}[2]{% \makebox[{\ifdim#2<\width\width\else#2\fi}]{#1}% } \begin{document} \noindent [\minwidthbox{i}{2em}]\\\relax [\minwidthbox{WXYZ}{2em}] \end{document} ...

10

You can use fit library to compute node's height. But with fitting nodes, it's better to add its contents with the label option. Following code defines a barstyle style with two arguments, the first one is the original node which is used to get its height while the second is the node contents. \documentclass{article} \usepackage{tikz} \usepackage{varwidth} ...

Only top voted, non community-wiki answers of a minimum length are eligible