Hot answers tagged

214

There are a few things that scaling doesn't affect; the most noticeable are node sizes and line widths. In a simple picture, it isn't hard to adjust the line width accordingly but the nodes can be difficult. It is possible to force a node to be scaled: put the scale option directly in the node's attributes. Thus \node[above,scale=0.6] at (8,11) {true}; ...


192

Use \textwidth for the width of the text block, and \paperwidth if you want to fit it into the paper width. You could also use \linewidth if you want to fit the image within the line width, which may vary depending on the environment you're in (for example, within a list like enumerate). Note that if you use \includegraphics outside a figure or table ...


142

\documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics[width=0.5\textwidth]{file} \end{document} In some cases \linewidth instead of \textwidth may be the better option. For example will it be the same as \textwidth in a single column document, but the same as \columnwidth in a two column document. \linewidth may also change ...


98

use the overpic package. \documentclass{article} \usepackage[percent]{overpic} \begin{document} \begin{overpic}[width=0.5\textwidth,grid,tics=10]{pictures/baum} \put (20,85) {\huge$\displaystyle\gamma$} \end{overpic} \end{document} will give you Remove the 'grid' option after you are done putting symbols in the picture. Overpic can basically be used as ...


82

How about \includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{myfig.png} EDIT: added keepaspectratio


61

You are looking for the macros \resizebox{<h-length>}{<v-length>}{<content>} and \scalebox{<h-scale>}[<v-scale>]{<content>} from the graphics/graphicx packages (→ graphics manual, 3.3 “Scaling”, p. 3). The \scalebox macro expects ratios like those you’d use in \includegraphics, you you would be using \begin{figure}...


52

If you're willing to just scale the entire table down, then this is fairly straight-forward, put it in a box and scale the box to \textwidth. \documentclass{article} \usepackage{graphicx} \begin{document} test \begin{table}[ht] \centering \resizebox{\textwidth}{!}{\begin{tabular}{rlrrrrrrr} \hline & X & MASHvstRap & MASHvsBEEML & ...


50

Use the adjustbox package's valign=t key to align the graphics contents at the top: \documentclass{article} \usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox \begin{document} \begin{figure} \centering \includegraphics[scale=0.5,valign=t]{example-image-a} \includegraphics[scale=0.3,valign=t]{example-image-b} \caption{A caption\label{fig:...


43

Maybe the most simple way to use relative coordinates is using scale=\textwidth/1cm and then only use values between 0 and 1 for your coordinates (assuming your basic scale size is 1cm). You could also estimate the size of your figure and use the same trick. I had that problem since the figure was already done and I wanted to scale it afterwards. \begin{...


39

As Stefan said, the width and height of the plot are only approximate. Stefan's solution is very nice in that the plot area including labels, titles, legends, and so on, will take up exactly the width of the text area. However, the text in your plot will be scaled, which may or may not be acceptable to you. A different approach would be to you use the ...


39

The solutions from Stefan and Jake scale the fonts, write into the margin or require some manual tweaking. I was heading for an automatic solution, so that nothing has to be tweaked again, if the document is changed. The fonts in all plots should have the same size, so resizebox was not an option for me. As I didn't want to plot into the margins either, I ...


39

The question wasn't "should it be done?" But, for the same reason men climb mountains, "could it be done?" The answer, with the scalerel package, is yes. Thus, we introduce \reallywidehat [EDITED to add phantom rule below argument, so that baseline of result matches baseline of original argument. RE-EDITED to \ensuremath on the \widthof calculation (...


36

This worked for me \begin{figure}[ht] \centering \includegraphics[width=1.0\textwidth]{Normal_Case_1_req_1_response} \caption{Normal Case: 1 Request \& 1 Response.} \label{normal_case} \end{figure}


36

TeX has an internal integer register called \mag whose value is initialized to 1000 and can be changed before a page is shipped out. If one sets \mag=1200 all dimensions will be increased by 20%. More precisely they are multiplied by \mag and divided by 1000, unless they are specified with the keyword true before the unit. Thus setting \dimen0=5 true cm ...


36

With explicitly adding width=7cm,height=3cm options to the Pgfplots axis environment you can control the size of the plot. Giving one of them will keep the aspect ratio constant hence would behave as a scaling only.


34

With the adjustbox package you can say \adjustbox{max width=\columnwidth}{...} that will scale the contents only if it exceeds the \columnwidth, according to the documentation: A good example is max width=\textwidth which will limit large content to the text width but will not affect smaller content. Of course \textwidth is just by way of example and ...


33

You can set the every picture locally in a group around the input file to set any option which should be used for the tikzpicture in that file. \begingroup \tikzset{every picture/.style={scale=0.3}}% \input{sometikzpic}% \endgroup However, if you have other tikzpictures inside nodes of the main picture they will also be affected (twice I mean). In this ...


33

If vertical size do not matter, then you could use \includegraphics[width=<X>\textwidth]{<first image>}% \includegraphics[width=<1-X>\textwidth]{<second image>} Here <X> denotes a number in (0,1), while <1-X> denotes its complement in the interval (0,1). Note the % to remove any space between the images. For equally-...


29

For more exotic requirements adjustbox or resizebox are useful but you don't really need any additional commands for this (other than a local command just to access @ commands more easily) \documentclass{article} \usepackage{graphicx} \makeatletter \def\maxwidth#1{\ifdim\Gin@nat@width>#1 #1\else\Gin@nat@width\fi} \makeatother \begin{document} \...


29

TeX has a magnification feature (which is used in plain Tex mostly as the format only loads 10pt fonts by default) it is not really supported or used in LaTeX. If you apply magnification then most lengths are scaled by the appropriate amount, however for referring to physical lengths such as the page size you need to refer to unmagnified lengths, so you can ...


29

As already mentioned in https://tex.stackexchange.com/a/97506/2975 you can use \resizebox or better adjustbox to scale the table to a specific width, e.g. \textwidth which is the width of the text on the page. This however might make your table text very small and hard to read. \documentclass{article} \usepackage{adjustbox} \usepackage{lipsum}% example ...


28

\usepackage{graphicx} ... \scalebox{1}[3]{hello}


28

There is no centering environment. And issuing \centering inside \resizebox doesn't make sense anyway: it should be outside, because you want to center the resized box. \documentclass[11pt,english,titlepage]{article} \usepackage{graphicx} \begin{document} \begin{table} \centering \caption{mytable} \resizebox{.5\textwidth}{!}{% <------ Don't forget this ...


27

You need rather less that \textheight to allow room for the title. Also, it's probably easier to use adjustbox than \resizebox: \documentclass{beamer} \usepackage{adjustbox} \begin{document} \begin{frame}{Well formulated title} \centering \adjustbox{max height=\dimexpr\textheight-5.5cm\relax, max width=\textwidth}{ \begin{tabular}{rrrrrrrr} ...


25

The adjustbox package can be used to scale (or otherwise adjust) images or any other content, like a tikzpicture in several ways. You need the max size={<width>}{<height>} option in your case, which does exactly what you requested, i.e. only shrink the content if it is larger than the given width and/or height. It always keeps the aspect-ratio. \...


23

You could load the relsize package and issue the command \relscale{0.95} % or whatever scaling is desired at the start of the document.


23

It appears as if you want to rescale the x coordinates without extracting some common factor. The scaled x ticks feature has the main use case of generating a common tick factor which is placed into some node... and, in fact, pgfplots has no builtin support for scaled ticks and log axes as it is typically no use-case. However, rescaling the x coordinates is ...


21

\newfontfamily{\myfamily}[Scale=MatchUppercase]{My Font} \newfontfamily{\myfamily}[Scale=MatchLowercase]{My Font} \newfontfamily{\myfamily}[Scale=0.8]{My Font} Choose what suits you best.


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