Kamis, 13 Februari 2025

Latex Figure Caption Preview 1

1. Open the Latex editor
2. Type this following Latex code in your Latex editor:
% !TEX TS-program = pdflatex
%% File Description:
%% * to create figure and sub figure caption centre alignment
%% * to create subfigures in the same line
%% * to create figure and sub figure caption float in the standalone class
%% * to format the label caption and format the label text
\documentclass[varwidth]{standalone}

%% Load packages
\usepackage[demo]{graphicx}
\usepackage[labelfont=it]{caption}
\usepackage[skip=0cm,list=true,labelfont=it]{subcaption}
\begin{document}
\begin{figure}[hptb]
\begin{subfigure}{.45\textwidth}
   \includegraphics[width=\textwidth]{img_a}
   \caption{\centering\it First subfigure}
\label{fig:g1}
\end{subfigure}%
\hfill
\begin{subfigure}{.45\textwidth}
   \includegraphics[width=\textwidth]{img_a}
   \caption{\centering\bf Second \tt subfigure}
\label{fig:g2}
\end{subfigure}
\caption{\centering\sf{Figure caption.}}
\label{fig:g}
\end{figure}
\end{document}
3. Save file as latexPreviewSubFig1.tex
4. Then build or typeset the Latex code.

Output


Notes 

  • To see the more clear picture, click on the picture.


Related Post

Tidak ada komentar:

Posting Komentar

Various Other Posts