Graphics, Figures & TablesFigures with Custom Size and Notes

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
lynnlee
Posts: 50
Joined: Fri Jan 04, 2013 10:15 am

Figures with Custom Size and Notes

Post by lynnlee »

Hello Latex Community,

I want to put figures in the text. The codes are as follows.

Code: Select all

\documentclass[11pt]{article}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

\begin{figure}[h]
\begin{centering}
 \subfloat[a]{\label{fig:fig1}\includegraphics[width=0.5\textwidth]{fig1}} 
\\ \subfloat[b] {\label{fig:fig2} \includegraphics[width=0.5\textwidth]{fig2}}
 \caption{my figure \\ \textit{Note: the resource of my figure.} } 
 \end{centering}
\end{figure}
\end{document}
But the two figures are in small size. I'd like it to be larger, actually to occupy the whole page is better. Is it possible to adjust the height of the figure? How to do that?

I also wish the caption in the middle, with "note" left aligned. But the above code shows the "Figure 1: my figure" on the left. I want it to be in the middle. How to do this?

I tried this code.

Code: Select all

\caption{ \textit{Note: the resource of my figure.}}
But the "note" was labeled "Figure 2". How to suppress "Figure 2"?

Any suggestion is appreciated.

Lynn

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Figures with Custom Size and Notes

Post by Johannes_B »

Code: Select all

\documentclass[11pt]{article}
\usepackage{subfig}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}[h]
\begin{centering}
 \subfloat[a]{\label{fig:fig1}\includegraphics[width=0.5\textwidth]{fig1}} 
\\ \subfloat[b] {\label{fig:fig2} \includegraphics[width=0.5\textwidth]{fig2}}
 \caption{my figure} 
 \end{centering}
\textit{Note: the resource of my figure.} 
\end{figure}
\end{document}
Please click on "Open in writeLaTeX" and check, but isn't the caption in the middle? Additionally, I wouldn't left-align the note, this way it doesn't seem to be with the caption. You could try a footnote instead.

Concerning the size of the pics: there is an optional argument called width, you told LaTeX to set the width of the picture equal to the half of the width of the text (0.5 of \textwidth, i.e. 50% of the text width).

Also note the demo option for the graphicx package.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figures with Custom Size and Notes

Post by localghost »

Perhaps something like this.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}
  \begin{figure}[!ht]
    \centering
    \subcaptionbox{First\label{subfig-1:dummy}}{%
      \includegraphics[scale=0.75]{example-image-a}
    } \\
    \subcaptionbox{Second\label{subfig-2:dummy}}{%
      \includegraphics[scale=0.75]{example-image-b}
    }
    \caption{Figure caption}
    \label{fig:dummy}
    \captionsetup{font=it,singlelinecheck=off}
    \caption*{Note: The resource of my figure.}
  \end{figure}
\end{document}
For details please refer to the manuals of the involved packages. The rest has already been mentioned by Johannes.


Remarks:

Thorsten
lynnlee
Posts: 50
Joined: Fri Jan 04, 2013 10:15 am

Re: Figures with Custom Size and Notes

Post by lynnlee »

Thanks, Johannes and Thorsten.

Lynn
Post Reply