TransWikia.com

How to make the subfloat below and centered with the Figures

TeX - LaTeX Asked by Sílvio on September 24, 2020

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.5columnwidth]{Capitulo4/Figuras/placaplana1.png}}
        qquad
        subfloat(b) {includegraphics[width=0.4columnwidth]{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.46columnwidth]{Capitulo4/Figuras/placacorrugada1.png}}
        qquad
        subfloat(b) {includegraphics[width=0.44columnwidth]{Capitulo4/Figuras/placacorrugada2.png}}
        qquad
        subfloat(c) {includegraphics[width=0.95columnwidth]{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

One Answer

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.46columnwidth]{Capitulo4/Figuras/placacorrugada1.png}label{placacorrugada1}}
        qquad
        subfloat[my subcaption text]{includegraphics[width=0.44columnwidth]{Capitulo4/Figuras/placacorrugada2.png}label{placacorrugada2}}
        
        subfloat[my subcaption text]{includegraphics[width=0.95columnwidth]{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.45linewidth]{Capitulo4/Figuras/placacorrugada1.png}label{placacorrugada1}}
        hfill
        subfloat[]{includegraphics[width=0.45linewidth]{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}

Answered by leandriis on September 24, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP