New answers tagged

8

Here is the theory; the image does not seem to align to the top and bottom of the integral sign because it has some white space above and below that I didn't remove. Use your own image, of course. \documentclass{article} \usepackage{graphicx} \makeatletter \DeclareRobustCommand{\duckintegral}{% \mathop{\mathpalette\duck@integral\relax}\nolimits } \...


2

If file size does not matter, the best solution is arguably to upsample the image, for example using ImageMagick: convert small.png -filter point -scale 10000% large.png You can install ImageMagick on macOS using Homebrew: brew install imagemagick You can also use batch processing in the current directory using a loop like this: for f in *.png: ...


1

If you want to have control over the placement of the figure floats without the floating behaviour, the use the [H]ERE float specification provided by the float package: \documentclass{report} \usepackage{graphicx,float} \begin{document} \raggedbottom \chapter{A chapter} \section{First section} \subsubsection{First subsection} \begin{figure}[H] \...


0

This is a file from the R project. You can compile it to pdf with Sweave("path/to/your/file.Rnw"). This will result in a new .df file that contains your graphic. Now you can include this pdf in your document with the \includegraphics command. \includegraphics[scale=0.5]{path/to/the/generated/file.pdf} \includegraphics has options like scale, width or ...


0

This is not the full solution yet -- for some reason the ToC color is wrong if the next \section does not have a \subsection etc. The solution uses xcntperchap to track the number of images per section, subsection and subsubsection. If this number is zero, the ToC color is changed. \documentclass[a4paper, hidelinks]{article} \usepackage{xcolor} \...


4

ctan now has the package qrcode, which doesn't need any tricks for pdfLaTeX. The default is a 2cm square, but an option allows you to change the height. (And since you specifically mentioned the width, I'll state the obvious fact that the height and width of the square are equal.) For example, the document \documentclass{article} \usepackage{qrcode} \...


4

This isn't hugely difficult, and the pictures use nothing that isn't obviously in the manual: \documentclass[varwidth,border=5]{standalone} \usepackage{tikz} \tikzset{ball/.style={shape=circle, shading=ball, ball color=blue!50!cyan!50, minimum size=0.375cm}} \begin{document} \centering \begin{tikzpicture} \draw circle [radius=1]; \foreach \i in {0,...,7} ...


4

The package subfigure is obsolete and shouldn't be used any longer. There are two alternatives: subfig or subcaption. Use \usepackage[font=Large]{subfig} for larger caption labels, for example. \documentclass{article} \usepackage[demo]{graphicx} %\usepackage{amssymb} \usepackage{caption} \usepackage[font=Large]{subfig} \begin{document} \...


0

You did \quad before the the third \includegraphics moving it behind it like in the other cases should fix it. \begin{figure}[H] \begin{subfigure}{0.3\textwidth} \centering \includegraphics[width=.8\linewidth]{imp_1.png}\quad \caption{image1} \label{fig:1} \end{subfigure}% \begin{subfigure}{0.3\textwidth} \centering \includegraphics[width=.8\...


4

You can add a graphics rule (I didn't test if it works for all sort of pathes and curious file names): \documentclass[a4paper,12pt]{book} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage{etoolbox} \makeatletter \preto\Gin@extensions{svg,} \DeclareGraphicsRule{.svg}{pdf}{.pdf}{\noexpand\Gin@base.pdf} \makeatother \...


2

It is always possible to redefine a command, the question is : will it break something if I do it? If you are certain that \includegraphics is used only to import svg files, than this should work: \documentclass{article} \usepackage{graphicx} \let\oig\includegraphics \def\topdf#1.svg{#1.pdf} \renewcommand{\includegraphics}[2][]{\oig[#1]{\topdf#2}} \begin{...


2

One more suggestion: make figure content centered with use of \centering between sub figures insert \hfil purpose of \quad is not clear, let remove it centering of subfigure content is surplus. Rather make sub figure width smaller and adopt figure width to width of subfigure Complete code: \documentclass{article} \usepackage{graphicx} \usepackage{...


0

I don't think you need those \quads. Add a blank line between the rows. \documentclass{article} \usepackage[demo]{graphicx} \usepackage{caption} \usepackage{subcaption} \usepackage[showframe]{geometry} \begin{document} \begin{figure}[H] \begin{subfigure}{0.3\textwidth} \centering \includegraphics[width=.8\linewidth]{imp₁.png} \caption{...


0

Please check this: \documentclass{article} \usepackage{graphicx,subfigure} \begin{document} \begin{figure}[t!] \centering \subfigure[image1]{\fbox{\hbox to 5pc{\vbox to 5pc{~}}}}\quad \subfigure[image2]{\fbox{\hbox to 5pc{\vbox to 5pc{~}}}}\quad \subfigure[image3]{\fbox{\hbox to 5pc{\vbox to 5pc{~}}}}\quad\\ \subfigure[image4]{\fbox{\hbox to 5pc{\vbox to ...


1

The problem is unsupported compressed objects in BaKoMa TeX before V 11.0 In this reason, there are two ways to solve the problem: 1) Use most recent version of BaKoMa TeX, version 11.0 or later 2) Convert PDF such that to uncompress objects which may be done by saving PDF in 1.4 compatibility mode.


3

For fun, here is a solution in ConTeXt. The solution relies on my wrapper around the drops module by Peter Rolf. The drops module uses imagemagic to draw the shadow (which looks more realistic than the tikz-style shadows) \usemodule[dropshadow] \setupexternalfigures[location={local,global,default}] \definedropshadow [polaroid] [flatdark] [...


2

Yes, it's possible. MWE combines tips from various places and a bit of elbow grease. I used Qrrbrbirlbel's answer on tikz: Can we set the corner coordinates of a rectangle? to set up the block's styling as a node rather than \draw ... rectangle. I used Mark Wibrow's answer on How to set actual width for a rounded corners image using TikZ? for the path ...


0

In addition to Steven B. Segletes' answer, I have made a modification that offers to separate scaling-relevant from scaling-irrelevant arguments, so that, for example, a trimmed image can be used as the scaling base: \usepackage{graphicx,fp} \newcount\scaledwidth \newcount\unscaledwidth \newcommand{\SetTrimIncludegraphics}[3]{% % #1: scaling, #2: trimming ...


2

I was searching for a solution for some time so it's probably usefull for someone else. You have to do the following in the same order: In Visio: Go to options and open Customize Ribbon Add the developertools to the menu Go to the developer tab and open Show ShapeSheet -> Print Properties Edit PageLeftMargin, PageRightMargin, PageTopMargin and ...


2

The following patch updated \makecvheader to insert an image to the left of the name. It's set using a left overlap so as to maintain the regular layout. Add \usepackage{etoolbox} \patchcmd{\makecvheader}% <cmd> {\headerfirstnamestyle}% <search> {\leavevmode% Start paragraph \llap{% Left overLAP \includegraphics[height=29pt]{example-...


3

How about this? \caption has an optional argument, which you can use to have a different text in the List of Figures. Output Code \documentclass[11pt]{article} \usepackage{graphicx} \begin{document} \listoffigures \begin{figure}[hbt] \includegraphics[width=.5\linewidth]{example-image-a} \caption[Short caption for LoF]{Really long caption with lots ...


2

Something like this? (The [b] position specifiers are needed to bottom-align subfigures b and c.) \documentclass[demo]{report} % omit 'demo' option in real document \usepackage{graphicx,subcaption} \begin{document} \setcounter{chapter}{1} % just for this example \begin{figure} \begin{minipage}[b]{0.45\textwidth} \begin{subfigure}[b]{\linewidth} \...


3

Compile with lualatex \documentclass{article} \usepackage[demo]{graphicx} \usepackage{luacode} \begin{document} \newcommand\w{\directlua{tex.sprint(1/3)}} This is my graph, it has width of \w and it looks very nice \includegraphics[width=\w\textwidth]{} \end{document}


5

Informally, length calculation are done using factor multiplication as there is no division notation. Since any division can be represented as some multiplication, this shouldn't be a problem. So, .5\textwidth refers to half (1/2) of \textwidth, while 2\wd0 refers to twice the width of box 0. In your case it suffices to use \includegraphics[width=0.3333\...


5

Savebox You could use \savebox, but you need to add caption, labels, and \begin{figure}/\end{figure} each time you want to to that. This is more flexible, but needs a bit more work everytime you need to add an image. Hopefully, you don't need to include the same image too many times. \documentclass[11pt]{article} \usepackage{graphicx} \newsavebox{\...


2

From you code I observe: you probably use deprecated package subfigure which is directly replaced with subfig. Beside it there is also very powerful subcaption your image together have width 1,6 text width, this is not possible to put in one row without to locally extend place for figures for 60% ..., for this the use of \hspace*{3.5cm} is not the best ...


1

The standard behavior of \paragraph is to print the heading in-line. If you want a line break after the heading, type \paragraph{Fremdschlüssel}\mbox{}\\* \includegraphics[width=0.4\textwidth]{Resources/Included Graphics/foreign_keys_example.png}


0

Just to add to this if anyone still has this problem, I found a pretty simple way to fix it. I was getting this error: TeX capacity exceeded, sorry [main memory size=5000000] I went through a lot of guides to increase the main memory and nothing was working :/ But I read a few articles where they talked about save_size instead of main_memory. I edited ...


0

Here's the official guide on inserting images in ShareLaTeX: https://www.sharelatex.com/learn/Inserting_Images In particular, this is how you set the path: %Path in Windows format: \graphicspath{ {c:/user/images/} } %Path in Unix-like (Linux, OsX) format \graphicspath{ {/home/user/images/} }


2

Maybe you are compiling in "draft" instead of "normal" mode. You can switch between these options in the dropdown menu of the compile button. Draft mode will enable you to compile faster, but it won't load images.


2

With help of package adjustbox you can obtain: In the first row the margin above and below picture is added, in the second row the image is without added margins. The code: \documentclass{article} \usepackage{graphicx} \usepackage[export]{adjustbox} \begin{document} \begin{table}[htbp] \centering \caption{My caption} \label{tab:mytab} \...


2

In the provided example, a minus sign was left off the length .5\totalheight. Graphical images are set above the baseline, when using \includegraphics, whereas tabular cells are centered. Thus, one must move the graphical image down by half its height to compensate. \documentclass{article} \usepackage{graphicx} \begin{document} \begin{table}[htbp] \...


1

It is not clear which document class you are using but if I understand your question right, this should do what you need \documentclass{article} \usepackage[left=2cm,right=2cm]{geometry} \usepackage[demo]{graphicx} \usepackage{tabularx} \usepackage{hyperref} \newcolumntype{R}{>{\raggedleft}X<{}} \begin{document} \noindent \begin{tabularx}{\...


1

First, as a man who has been typesetting French documents in France, I strongly recommend using direct Unicode input of your accented chars. Instead of \c ca br\^ ule, write ça brûle as usually; you have \usepackage[utf8]{inputenc} on your side! Second, for an MWE, get rid of all those extra packages. See if any of them is causing trouble. For example, ...


5

A solution with the plain TeX set of macros insbox: \documentclass[11pt, x11names]{article} \usepackage[utf8]{inputenc} % \usepackage[T1]{fontenc} \usepackage{cabin} \usepackage{geometry} \usepackage{tcolorbox} % \input{insbox} \begin{document} \begin{tcolorbox}[width=\linewidth, fonttitle =\sffamily\bfseries\Large, title=Bright Star, colback=MistyRose1!...


5

\documentclass[]{article} \usepackage{graphicx} \usepackage{lipsum} \usepackage{wrapfig} \usepackage[most]{tcolorbox} \begin{document} \begin{tcolorbox}[colback=white!60!yellow,colframe=red] \begin{wrapfigure}{r}{0.5\textwidth} \begin{center} \includegraphics[width=0.4\textwidth]{example-image} \end{center} \caption{image} \end{wrapfigure} \lipsum[1] \...


6

A way with nested tcolorbox environments in a raster. With more setup and time this should be used with specialized tcolorbox environments and special styles. A nice feature is the raster multicolumn approach, in my point of view. Please note, that this box is not breakable any longer! \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{...


1

I didn't know the caption package. However, I have found another cool way, using the following code: \newsavebox{\@margin@floatbox} \newenvironment{@margin@float}[2][-1.2ex]% {\FloatBarrier\begin{lrbox}{\@margin@floatbox}% \begin{minipage}{\marginparwidth}% % can swap left/right align if desired. % \checkoddpage % \ifoddpage % \def\...


2

In order to use automatic numbering and some description, \caption can't be used here, since \marginpar (nor \marginnote) is a floating environment, but \captionof{figure} will work. This requires the caption box, which is highly recommended due to its high configurability. \documentclass[a4paper]{article} \usepackage{marginnote} \usepackage[rmargin=4cm]{...


0

% *** GRAPHICS RELATED PACKAGES *** % \ifCLASSINFOpdf \usepackage[pdftex]{graphicx} % declare the path(s) where your graphic files are \graphicspath{{../pdf/}{../jpeg/}} % and their extensions so you won't have to specify these with % every instance of \includegraphics \DeclareGraphicsExtensions{.pdf,.jpeg,.png} \else % or other class option (...


0

As you didn't provide a working MWE I created one, which I guess is what you could be looking for. A very basic twopage article with figures and tables. Appendix is just a matter of adding the macros here. \documentclass[twocolumn]{article} \usepackage{graphicx} \usepackage{caption} \begin{document} \begin{figure} \centering \includegraphics[width=5cm]{...


3

Here I introduce \SetIncludegraphics[]{} for the reference image whose purpose is to compute the \myscale while setting the image. What it does (in temporary boxes) is compare the results of the \includegraphics with and without the application of the optional argument. The \myscale is computed as the ratio of the widths of two images with vs. without the ...


3

I just had a similar issue. For me the problem was EXIF data in jpg file. Basically, the image is saved in other direction and has a flag that tells image viewers to rotate it. It's better to rotate the image this way, since each file rotation transformation lowers the quality. The best solution would be to make latex to use this flag. The simplest - just ...


0

According to the comment by John Kormylo, the afterpage package can be used for this. This is an updated example showing the effect. \documentclass{book} \usepackage[vmargin=2.5cm, rmargin=2.5cm, lmargin=2.5cm]{geometry} % Adjust page margins \usepackage{tikz} \usepackage[explicit, pagestyles]{titlesec} \usepackage{bold-extra} \usepackage{lmodern} \...


3

With expl3 facilities, you can easily get the scaling factor: \documentclass{article} \usepackage{graphicx} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\setscale}{mmm} {% #1 is the object to scale, % #2 the width to scale to, % #3 the name for the scale factor \hbox_set:Nn \l_tmpa_box { #1 } \tl_clear_new:c {l_douba_scale_#3_tl} \...


1

Is this more or less what you want? I used the titling package, which defines 4 hooks to insert commands within the \maketitle command: \maketitlehooka, used before the _title command, \maketitlehookb, between \title and author, \maketitlehookc, between author and date, \maketitlehookd, after date. \documentclass{report} \usepackage[english , greek]{babel}...


5

The following example defines \setscalewidth[<options>]{<image} (and \setscaleheight) to set the scale used by LaTeX when including an image using \includegraphics[<options>]{<image>}: \documentclass{article} \usepackage{xparse,graphicx} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff \makeatletter \newcommand{\...


5

Here is my try:  The three images have different widths (big, medium and small), but the star has the same size on each. I used \settowidth to get the original image width, and \pgfmathsetmacro to divide the dimentions (answere by Matthew Leingang here helped me). \documentclass{article} \usepackage{graphicx} \usepackage{pgf} \begin{document} \newlength{\...


2

Since svg loads subfig, which is in turn incompatible with subcaption,there's not left: Use \subfloat inside of a figure environment. The subfigure package is obsolete and shouldn't be used any longer! \documentclass{article} \usepackage{graphicx} \usepackage{svg} \usepackage{subfig} \begin{document} \begin{figure}% \centering \subfloat[First.]{\...


1

This is not really an actual solution but more of a workaround. Instead of copying the image into its Float Figure container, I use the Insert graphics tab beneath the menu bar. A more definite solution was to reinstall lyx (make sure you save the files you've been working on before; do not leave anything in the default working directories).



Top 50 recent answers are included