0

I'm new to using Latex and I have a question. How to make the subfloat below and centered with the Figures? Follow the code and images of the assembly using 2 and 3 figures.

WITH 2 FIGURES

\begin{landscape}
\begin{figure}[!h]
    \centering
    \caption{Modelo físico de placa plana isotérmica imersa em domínio de ar em (a) vista isométrica e (b) vista superior.}
        \subfloat(a)
        {\includegraphics[width=0.5\columnwidth]{Capitulo4/Figuras/placaplana1.png}}
        \qquad
        \subfloat(b) {\includegraphics[width=0.4\columnwidth]{Capitulo4/Figuras/placaplana2.png}}
    \label{fig:placaplana1}
\legend{Fonte: Próprio Autor.}
\end{figure}
\end{landscape}

WITH 3 FIGURES

\begin{landscape}
\begin{figure}[!h]
    \centering
    \caption{Vistas (a) superior total, (b) superior com um quatro de domínio por dupla simetria em relação aos eixos y e z e (c) frontal, da placa corrugada e objeto de estudo desta tese.}
        \subfloat(a) {\includegraphics[width=0.46\columnwidth]{Capitulo4/Figuras/placacorrugada1.png}}
        \qquad
        \subfloat(b) {\includegraphics[width=0.44\columnwidth]{Capitulo4/Figuras/placacorrugada2.png}}
        \qquad
        \subfloat(c) {\includegraphics[width=0.95\columnwidth]{Capitulo4/Figuras/placacorrugada3.png}}
    \label{fig:modeloplacaretangular}
\legend{Fonte: Próprio Autor.}
\end{figure}
\end{landscape}

Attached images follow.

Thank you all for the attention.

enter image description here

5
  • Welcome to TeX.SE.
    – Mico
    Commented Aug 2, 2020 at 4:34
  • 1
    Please tell us which document class you employ and which package(s), if any, you load to create subfloats.
    – Mico
    Commented Aug 2, 2020 at 4:37
  • I don't know how to answer the question exactly. Documentclass article, I guess. No package (s)
    – Sílvio
    Commented Aug 2, 2020 at 6:43
  • Regarding "no packages I guess": If you don't load a package that defines \subfloat, your document can not compile. You will instead be left with error messages complaining about an undefined control sequence. Do you load the subfig or the subcaption package in your actual document? If so, which of the packages do you use? Apart from that, \legend is not a standard command either. You must have added a package that defined \legend or used \newcommand{\legend}... in your preamble. Please also add this information to your question.
    – leandriis
    Commented Aug 2, 2020 at 8:39
  • BTW, for a single page of landscpae, [p] is better than [!h]., although since there is an automatic \clearpage before and after, the only difference is the spacing above and below. Commented Aug 2, 2020 at 20:56

1 Answer 1

3

The syntax of the \subfloat command you tried to use in your original code does not match the syntax that is edfined in the subfig or the subcaption package. Based on your comment "No package (s) " I assume, you actually did not include either subfig or subcaption in your document. Without one of the two packages, you should recieve Undefined control sequence. \subfloat upon trying to compile your document. Once you recuieve an error message, do not look at the output. Even if you get something that on first glance resembles a pdf file, there can still be issues with it. After an error, TeX only tries to recover enough to syntax check more of the file, it does not try to make sensible output after an error. Therefore, please don't ignore error messages but try to fixt them, before worrying about dapting the output.

The correct syntax of the \subfloat command is as follows:

\subfloat[<listentry>][<sub-caption>]{<body>}

<listentry> is optional and refers to the caption text that is added to the list of figures/tables

<sub-caption> is optional as well and refers to the caption text (not the number!) that is added with your image. If you want an output such as "(a) my subcaption text here", use \subfloat[my subcaption text here]{<body>}. If you just want to get an output such as "(a)", use \subfloat[]{<body>} with an empty optional argument.

<body> refers to the correpsonding image/tabular

In the following MWE, I have corrected the syntax of \subfloat according teh the above explanations. I have also used \subfre in order to refer to induvidual subfigures in the main caption. If you decide to rearrange the figures (e.g. swith subfigure a and b) there is no need to alter the main captions, as the letters will adapt automatically.

With \captionsetup[subfigure]{position=bottom} I made sure the subcaptions are placed below the corresponding images.

In the second example, I have slighlty altered the widths of the images and additionally slightly changes the spacing in order to allow for an improved horizonal alignment. The left edges of image a and c are now aligned, likewise the right edges of image b and c.

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx} % do not use the demo option in your real document!
\usepackage{pdflscape}
\usepackage{subcaption}
\captionsetup[subfigure]{position=bottom}
\begin{document}

\begin{landscape}
\begin{figure}[!h]
    \centering
    \caption{Vistas (\subref{placacorrugada1}) superior total, (\subref{placacorrugada2}) superior com um quatro de domínio por dupla simetria em relação aos eixos y e z e (\subref{placacorrugada3}) frontal, da placa corrugada e objeto de estudo desta tese.}
    \label{fig:modeloplacaretangular}
        \subfloat[my subcaption text]{\includegraphics[width=0.46\columnwidth]{Capitulo4/Figuras/placacorrugada1.png}\label{placacorrugada1}}
        \qquad
        \subfloat[my subcaption text]{\includegraphics[width=0.44\columnwidth]{Capitulo4/Figuras/placacorrugada2.png}\label{placacorrugada2}}
        
        \subfloat[my subcaption text]{\includegraphics[width=0.95\columnwidth]{Capitulo4/Figuras/placacorrugada3.png}\label{placacorrugada3}}
    
%\legend{Fonte: Próprio Autor.} % commented out because I don't know where/how it is defined in your original document.
\end{figure}
\end{landscape}


\begin{landscape}
\begin{figure}[!h]
    \centering
    \caption{Vistas (\subref{placacorrugada1}) superior total, (\subref{placacorrugada2}) superior com um quatro de domínio por dupla simetria em relação aos eixos y e z e (\subref{placacorrugada3}) frontal, da placa corrugada e objeto de estudo desta tese.}
        \subfloat[]{\includegraphics[width=0.45\linewidth]{Capitulo4/Figuras/placacorrugada1.png}\label{placacorrugada1}}
        \hfill
        \subfloat[]{\includegraphics[width=0.45\linewidth]{Capitulo4/Figuras/placacorrugada2.png}\label{placacorrugada2}}
        
        \subfloat[]{\includegraphics[width=\linewidth]{Capitulo4/Figuras/placacorrugada3.png}\label{placacorrugada3}}
    \label{fig:modeloplacaretangular}
%\legend{Fonte: Próprio Autor.}
\end{figure}
\end{landscape}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .