147 votes

I can't figure out why my ref is displaying question marks instead of a figure number regarding a float

The \label should always be after \caption: Please see figure \ref{loginMock}. \begin{figure}[H] \centering \includegraphics[width=7cm]{loginIdea} \caption{Landing/Login Page Example} ...
Romain Picot's user avatar
  • 6,640
104 votes

How to put the caption below the listing?

[Answer from OP, originally edited into question] I found a solution. \begin{lstlisting}[caption={My Caption},captionpos=b]
61 votes

Change caption name of figures

This is a simple solution: \usepackage[figurename=Fig.]{caption} Works with and without babel. Use tablename for tables.
Peque's user avatar
  • 833
56 votes

Force figure placement in text

One solution not mentioned by any of the other answers that just sorted me out is to use \clearpage No special packages are needed. \clearpage forces all figures above it in the .tex file to be ...
tom's user avatar
  • 758
46 votes

The space between the table and its caption is very small

My attention was drawn to this question by another one that had been posted on TeX-LaTeX Meta. In spite of having been asked almost six years ago, not only—IMHO, of course!—is this question still ...
GuM's user avatar
  • 21.4k
44 votes

No caption number for figures and tables

You can also use \caption* when using the caption package which keeps only the caption title. You may do something else what did not work, but this example works as desired: \documentclass{article} \...
suppy's user avatar
  • 441
39 votes

Align Caption to the left

You should add the following instruction to the preamble, after loading the caption package: \captionsetup{justification=raggedright,singlelinecheck=false} If you want "hanging indentation" of ...
Mico's user avatar
  • 495k
39 votes

Why are figures unnumbered with beamer?

This is conceptual rather than technical decision by the original author of beamer, Till Tantau. When giving a presentation, the expectation is that the presenter will talk about figures (or other ...
38 votes

TeXLive Pretest 2018: beamer and subfig collide

It is enough to add a definition of the command to \relax \documentclass{beamer} \usepackage{subfig} \makeatletter \let\@@magyar@captionfix\relax \makeatother \begin{document} test \end{document} ...
David Carlisle's user avatar
30 votes

How can I modify vertical space between figure and caption?

You can use the caption package for this: \usepackage[skip=2pt]{caption} % example skip set to 2pt This will effect all figures. The documentation says: The vertical space between the caption ...
Markus Weninger's user avatar
28 votes

Different font sizes for Figure and Subfigure Captions

You can use the [sub] optional parameter of \captionsetup, e.g. \captionsetup{font=normalsize,labelfont={bf,sf}} \captionsetup[sub]{font=small,labelfont={bf,sf}} BTW, I would add a \centering in ...
27 votes

Reference subfigure by letter only

Use the \subref-command (from section 6.1 in the subcaption docs): \documentclass{article} \usepackage{caption} \usepackage{subcaption} \begin{document} \begin{figure} \begin{minipage}[b]{.5\...
Andreas Storvik Strauman's user avatar
26 votes

Font size of Figure Caption Header

Not sure why but the answer above did not work for me. If that's the case for you, simply declare: \usepackage{caption} \captionsetup[figure]{font=small} For more detail see: Changing Figure ...
user659986's user avatar
26 votes

Why are figures unnumbered with beamer?

However, if you anyway persist to have numbered figures (after reading @Joseph Wright answer at least twice :) ), you need add to preamble: \setbeamertemplate{caption}[numbered] i.e.: \...
Zarko's user avatar
  • 293k
24 votes

Caption on the side of a figure

Use the sidecap package. \usepackage{sidecap} \begin{SCfigure} \includegraphics{fig} \caption{Foo bar} \end{SCfigure} See vertical position of sidecap figure w.r.t. top aligned caption
Frank Breitling's user avatar
23 votes

How can I specify a short caption for a listing?

listings' caption key allows you to use the same syntax as \caption[short title]{long title} but you have to wrap braces around the value that you pass to the caption key, in order to "hide" the ...
jub0bs's user avatar
  • 58.5k
23 votes

text, margin, and text + margin width floats without using tufte class

You could use the sidenotes-package: \documentclass[twoside]{scrartcl} \usepackage{showframe} \usepackage{graphicx} \usepackage{placeins} \usepackage{sidenotes} \usepackage{...
DG''s user avatar
  • 21.5k
21 votes

How to insert "source" below image

\documentclass{article} \usepackage{graphicx} \usepackage[x11names]{xcolor} \usepackage{copyrightbox} %%%% figure-copyright \usepackage{url} \begin{document} \begin{figure}[!h] \copyrightbox[...
Zarko's user avatar
  • 293k
19 votes

Only one caption under multiple subfigures

You can put all figures of a row in only one subfigure environment. Example (assuming package subcaption is used): \documentclass{article} \usepackage{subcaption} \usepackage[demo]{graphicx} \begin{...
esdd's user avatar
  • 85k
17 votes

Width of the caption of a figure

Instead of using a predetermined width, one can measure the width using a savebox and put the caption inside a minipage. \documentclass{article} \usepackage{graphicx} \usepackage{blindtext} \begin{...
John Kormylo's user avatar
  • 77.9k
16 votes

It is possible to print the title of a plot below the x axis?

Lets summarize and extend above comments. The first and the last (from John Kormylo and mine) propose solution to place graph title as part of graph, the second propose to omit title as part of graph ...
Zarko's user avatar
  • 293k
15 votes

How can I left-align a caption?

Put \captionsetup{singlelinecheck = false, justification=justified} after \begin{figure} would solve the problem.
user125659's user avatar
15 votes

KOMA-Script and sidenotes : how to format side (margin) caption and its caption label?

The sidenotes package uses package caption to define a caption style sidecaption. You can redeclare this style: \documentclass{scrartcl} \usepackage[T1]{fontenc}% <- added \usepackage{lipsum} \...
esdd's user avatar
  • 85k
15 votes

Error: Illegal parameter number in definition of \reserved@a

\overrightarrow is not robust and breaks in moving arguments. Protect it with \protect: \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{caption} \usepackage[mathscr]{...
Heiko Oberdiek's user avatar
14 votes

Add both a vertical side caption and a normal caption to a picture

The copyrightbox package is done precisely for that: \documentclass{book} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{ebgaramond} \usepackage{graphicx} \usepackage[x11names]{...
Bernard's user avatar
  • 270k
14 votes

Why does LaTeX step the footnote counter twice in a two-line caption?

It steps it because the caption is typeset twice. Firstly it is set in an \sbox and measured, and if that one-line setting would fit the box is centred, however if that line would be too long, the ...
David Carlisle's user avatar
13 votes

Force figure placement in text

You can now use the adjustbox package to turn your boxed stuff into a non-floating float replacement using the nofloat=<type> key. Caption and label can be added by own keys, before the nofloat. ...
Martin Scharrer's user avatar
13 votes

How to reduce space between image and its caption?

For locally change the caption position you can also use a negative value on the setting. For example, when the figure has larger white part, e.g use \vspace{-1cm}, instead of changing the figure ...
Alan Ayala's user avatar

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