New answers tagged

0

Adapting the solution by @Konrad Rudolph to something that is simple and doesn't break anything: \inputminted[linenos]{python}{code.py} \begin{figure}[H] \caption{Hello.} \label{fig:foo} \end{figure} Of course, this is going to be named and listed as a Figure, but that's not a problem for me.


3

A slightly more robust solution than that proposed by @HeikoOberdiek is to use \Alph to format the name of the current appendix. For example, I have multiple appendix chapters (A, B, etc.), and otherwise have my table names formatted with a period between chapter number and table number, so the following update of \thetable continues this convention through ...


4

[lt;dr] When text has to be put into a box, don't check the distances ;-) Long explanation: KOMA-Script has to put the caption text into a box to provide the given functionality. But TeX only has one baseline per box, and when you put text into a box, you have decide where to put the baseline, at the top or at the bottom line. Whatever you choose, the ...


0

Well, you gave no MWE so your question is not very clear. I guess with your "references of the figure" you mean a text explaining where you got the immage, for example a article or book. In my example code I just wrote some text, please change it to what you need ... Please see the following code: \documentclass{article} \usepackage{graphicx} ...


5

Here is a solution with wrapfigure. I replaced the items of a description environment (wrapfigure won't work) with a special formatting of \paragraph with the titlesec package, in order to mimick the layoout of a description environment: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{fourier, erewhon} ...


4

It's simpler to do it with pst-node: consider variables you want to link as \rnodes, and connect them with the \ncbar command: \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{mathtools} \usepackage{pst-node, auto-pst-pdf} \begin{document} \begin{postscript} \begin{equation} \begin{gathered} \phi (\rnode{n1}{x_1}) \quad \phi ...


3

Inspired by Bernard answer, just for exercise, below is solution based on TikZ picture: \documentclass[tikz, border=3mm, preview ]{standalone} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix (m) [matrix of math nodes,inner ysep=0pt,row sep=2ex] { \phi(x_1) & \phi(x_2) & ...


2

With tcbraster from tcolorbox it's very easy to organize graphics (boxes) into an array form. Just decide number of columns and tcbraster will decide everything else. \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{figure} \begin{tcbraster}[raster columns=3, enhanced, blankest] ...


1

Here's a solution that uses three side-by-side minipage environments, each with width 0.33\textwidth. \documentclass[demo]{article} % omit 'demo' option in real document \usepackage{graphicx} \begin{document} \begin{figure} \hfill a \hfill\hfill b \hfill\hfill c \hfill{} % fake header row \medskip \begin{minipage}{0.33\textwidth} ...


2

Your question is quite unspecific, but one example could be to choose the size of the figures to be smaller than half the columnwidth. \documentclass{memoir} \usepackage{graphicx} \begin{document} \begin{figure}[htbp] \centering \includegraphics[width=0.45\columnwidth]{example-image-a} \hfill ...


1

Your question just helped me solve my problem. I was trying to put text and figure in one row of a table and could not get it to work. After reading your question, I tried the following to get my figure on right (and text on left). \begin{multicols}{2} The image to the right represents a \begin{enumerate} \item tree \item graph \end{enumerate} ...


4

The OP requests an example, so here is one. I set each figure to .32\textwidth, so that 3 of them not quite fill up a line. I place \hfill between them to give even separation. I use \\ between lines. All of this is within a minipage of .5\textwidth, though that doesn't necessarily make sense by itself inside a figure environment, unless you were going to ...


6

From the class documentation The LaTeX float placement commands [htbp] are intentionally disabled. Layout of figures and tables will be adjusted by the publisher during the production process, so authors should not concern themselves with placement to avoid disappointment and wasted effort. Ideally the optional argument would still be defined, ...


0

Is this what you are after? \documentclass{article} \usepackage{graphicx} \usepackage{multicol} \usepackage[export]{adjustbox} \begin{document} \begin{multicols}{2} \begin{enumerate} \item \includegraphics[width=4cm,valign=t]{example-image} \item \includegraphics[width=4cm,valign=t]{example-image} \item ...


1

Text \begin{figure}\centering% \vspace{1ex}% \includegraphics{image.jpg}% \end{figure} As of now, that's the best I can think of. If you include a minimal working example above, we could potentially try to be a tiny bit more precise.


1

As campa and barbara beeton mentioned - the caption in my first example is fitting in one single line and that's why it's automatically centered. Thanks a lot! edit: see Torbjørn T.'s comment to this answer for how to left-align all captions.


3

Yes. To place an image in the text, same as if you place any letter in the text, just place the cursor where you want the image, and do Insert --> Graphics. Many people seem to think that a floating environment (the figure environment) is required to add images, which is a misunderstanding.


1

I would simply use minipages like it is seen so often on TeX.SX. \documentclass{article} \usepackage{graphicx} \usepackage{subcaption} \begin{document} \begin{figure} \centering \begin{minipage}{.45\linewidth} \begin{subfigure}[t]{.9\linewidth} \includegraphics[width=\textwidth]{example-image-golden-upright} ...


0

There is no \caption before \label{t:table}, therefore the label is referencing the previous section. Example file with some other suggestions and some simplifications: \documentclass[a5paper]{report}% a5paper to get a smaller image for TeX.SX \usepackage{caption} \usepackage{booktabs} \usepackage{siunitx} \sisetup{output-decimal-marker={,}} \makeatletter ...


1

There is no need to load the caption package for changing the numbering. It suffices to use \renewcommand{\thetable}{\arabic{chapter}-\arabic{table}} with or without caption, even in memoir: \documentclass{memoir} \renewcommand{\thetable}{\arabic{chapter}-\arabic{table}} \begin{document} \chapter{A chapter} \begin{table} \caption{A table} ...


1

I had similar problems. Large gaps after figure floats. None of the above had any impact. It was the placement option for the figure floats. Right click on the "float: Figure" The issue stems from if you have large figures in close proximity to each other. Lyx tries to do what you've asked it to. If the check box indicates "Here definitely", the software ...


2

Here's a way of making the \fakefigure macro suggested in the question work. Well, at least it survives minimal testing in combination with Werner's answer on absolute placement. The proposed redefinition of \caption won't work because capt-of defines \captionof in terms of \caption. However, it is possible to first save the definition of \caption and then ...


2

If I understand what you're looking for, you may want to pursue the following approach: Using the facilities of your text editor, globally replace all instances of \begin{figure} with \par\noindent\begin{minipage}{\textwidth}% globally replace all instances of \end{figure} with \end{minipage} and globally replace all instances of figure-related ...


0

A very useful tip when debugging (La)TeX: first, get the problem down to a minimal working example. You did this. Second, compile the example and look at the warnings LaTeX emits. If you had done that, you would have seen that \autoref is trying to generate a reference to your footnote, instead of your table! The solution is to make the label earlier: ...


3

p figures will not drift into the document and will always be placed at the next page break if they are larger than \floatpagefraction \documentclass[]{book} \usepackage{lipsum} \usepackage[pagestyles]{titlesec} \usepackage{float} \usepackage{placeins} \usepackage[demo]{graphicx} \renewcommand{\thesection}{\arabic{section}} ...


2

\documentclass{article} \usepackage{hvfloat} \begin{document} \hvFloat[floatPos=!h,rotAngle=90,capPos=b,capVPos=c,capWidth=w,floatCapSep=10] {table}{% \begin{tabular}{|c|c|} \hline A & B\tabularnewline \hline \hline 1 & 2\tabularnewline \hline 3 ...


1

use the optional argument float: \lstinputlisting[language=php,caption={PHP code snippet A}, float, label=listing:codeA.php]{./codeA.php}


2

You can use \clearpage before the listing to flush any floats.


1

You can use algorithm and algorithmic to generate the protocol. more info here and here. To do the Protocols "preamble" (Party, input and so on) I would use a simple tabular. The final outcome would be something like this: \documentclass[a4paper,11pt]{article} \usepackage{algorithm} \usepackage{algorithmic} %need these for the protocol ...


3

Disclaimer: This is a derivative of touhami's answer. As mentioned above, this is also a poor way of doing it, but it works none-the-less. One problem with touhami's second solution is that if a figure has no notes, the ordering of the endnotes goes out of whack. For the past hour, I've been trying to get LaTeX to compile the values of the notes to the ...


8

Well, it seems there is a bug (or is it a feature?) in your used class IEEEtran. Or it results in the using of package subfigure, which called package caption. And that package caption results in the following warning you should not oversee: Package caption Info: Unknown document class (or package), (caption) standard defaults will be used. ) ...


3

Is this what you look for? \documentclass{scrreprt} \usepackage[demo]{graphicx} \usepackage{lipsum} \usepackage{enotez} \setenotez{list-name = {List of Figure notes:}} \DeclareInstance{enotez-list}{itemize}{list}{number =Figure \enmark{#1},list-type = itemize} \newcommand{\notes}[1]{Notes:\endnote{#1}} \begin{document} \lipsum[1] \begin{figure}[h] ...


2

If you don't need captions for each axis, I would suggest dropping the \subfloats altogether. They're not needed. I would also suggest putting the first four axes in a groupplot environment, then alignment is default. By only having axis labels on the outer edges you can also save some space. \documentclass{article} \usepackage{pgfplots} ...


1

Removing \qquad solved the problem


3

Package placins and \FloatBarrier might be of use here! \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{listings} \usepackage{color} \usepackage{courier} \usepackage{placeins} \usepackage{longtable,geometry} \definecolor{Gray}{gray}{0.95} \setlength\parindent{0pt} % Uncomment to remove all indentation from paragraphs ...


4

Captions of subfigures should be inside subfigure environment. Try if the following MWE gives, what you like to obtain: \documentclass{article} %\usepackage[catalan]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[a4paper, top=1.75truecm,bottom=1.75truecm, left=1.75truecm,right=1.75truecm]{geometry} ...


4

Try to use a \parbox{...} inside of the \fbox{...} and leave an empty line after two of the \includegraphics statements. \documentclass{elsarticle} \usepackage{graphicx} \begin{document} \begin{figure}[h] \centering \fbox{ % \parbox{0.7\textwidth}{% \centering \includegraphics[scale=0.25]{ente} \includegraphics[scale=0.25]{ente} ...


2

Inspired by solution in sidesubfloats (to which your question is very similar): \documentclass{article} \usepackage{floatrow} \usepackage{graphicx} \usepackage{subfig} \usepackage{caption} \floatsetup[figure]{style=plain,subcapbesideposition=top} \usepackage[margin=70mm]{geometry} \begin{document} ...


3

Try this: apply a \raisebox{\dimexpr-\height+\ht\strutbox}{...} to the image. The explanation is that the two minipages are, in fact, aligned to their top baseline (as requested with the [t] option of minipage). The problem is that included image extends well above the top baseline, whereas the text does not. This occurs because \includegraphics always ...


1

In answer to your questions about \linewidth: \documentclass{beamer} \newsavebox{\tempbox} \begin{document} \begin{frame}{size values} paper width = \the\paperwidth\par paper height = \the\paperheight\par text width = \the\textwidth\par text height = \the\textheight\par line width = \the\linewidth\par \savebox{\tempbox}{\fbox{test area}} ...


0

Figure is a float. This means that it's positioning is not always were you put it in the code, but where TeX deems it best (depending on the parameters you feed it. You might solve your issue by writing \begin{figure}[!htbp] or \begin{figure}[H] For a detailed answer see this post here: How to influence the position of float environments like figure ...


2

It seems that you have somewhere defined \thesection on different way as you expected. So if you instead \renewcommand{\thefigure}{\thesection-\arabic{figure}} use \renewcommand{\thefigure}{\arabic{section}-\arabic{figure}} you will obtain desired form of figure numbers.


2

Especially if you have pictures of different sizes, I find using scale very difficult. Either determine the size of an image by giving its height or width, e.g. \includegraphics[width=...]{...} or \includegraphics[height=...]{...} This can either be done in absolute values like width=3cm or relative values width=.33\textwidth, which makes the image ...


1

In your case you can change the default values for the relevant counters with the following lines: \setcounter{totalnumber}{5} % (default 3) \setcounter{topnumber}{4} % (default 2) Then your 4 tables will be displayed on one page as you wish. I changed the order of your package calls and commented that packages which are not needed for the problem ...


2

\documentclass[12pt]{article} \usepackage{float} \newfloat{video}{tbhp}{lst}%[section] \floatname{video}{Video} \def\Label{\refstepcounter{video}\label} \begin{document} Lorem ipsum (Video \ref{vid:example}). \begin{video} \Label{vid:example} \end{video} \end{document}


2

A working \label needs a \refstepcounter{} to be used before, with the relevant counter, say video. To get this more convenient, use a wrapper, say \genvidlabel with some argument that has the actual label suffix, say example etc. \documentclass[12pt]{article} \newcounter{video} \newcommand{\genvidlabel}[1]{% \refstepcounter{video}\label{vid:#1}% } ...


1

Just put all four tabulars into one table. (Note: my editor and inputenc are incompatible.) \documentclass[10pt,onecolumn]{article} \usepackage{graphicx} \usepackage{lmodern} %\usepackage[T1]{fontenc} \usepackage[spanish,,activeacute,es-lcroman,es-tabla]{babel} \usepackage{mathtools} %\usepackage[latin1]{inputenc} \usepackage{dcolumn} \usepackage{float} ...


6

You'll need to throw in \setbeamertemplate{caption}[numbered] in your preamble to make this work out.


1

That-a-way? You can reference the subfigures adding a label in the first argument of \subcaptionbox which is to contain the caption text and the label: \documentclass[]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[margin=1in, showframe]{geometry} \usepackage{caption} ...


1

You need only two minipages without a black line between them (but it is fine insert some space as \hfill or \quad). To left both at the bottom, you can use \vfill (or a figure environment with the [b] option, if the figure and text can float to another page) \documentclass[a4paper]{article} \usepackage{graphicx} \usepackage{lipsum} \begin{document} ...



Top 50 recent answers are included