Senin, 17 Maret 2025

Tables In Latex 3

Learning Objectives: Adjust the whitespace before and after Latex Table

1. Open the Latex editor.

2. Type this following latex code in latex editor:

% !TEX TS-program = pdflatex

% !TEX encoding = UTF-8 Unicode

% Distributed under the LaTeX Project Public License

% https://www.latex-project.org/lppl.txt

% pdflatex tableAdjustSpaceBeforeAfter1.tex

\documentclass{article}

%% Load Table packages and configuration
\usepackage{bm}

\usepackage{caption}

%% change this length to add space after first \hline

\setlength\extrarowheight{0.75em}

%% change this length to adjust space before and after the tabular environment

\setlength{\intextsep}{1cm plus .1cm minus 1cm}

%% change this length to add space after the caption of tabular environment

\setlength{\belowcaptionskip}{.2cm}

%% change this length to add space before the caption of tabular environment

\setlength{\abovecaptionskip}{0.5cm}


\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \\


\noindent

Text before tabular


\begin{table}[!htb]

\begin{tabular}{

|p{\dimexpr.5\linewidth-2\tabcolsep-1.3333\arrayrulewidth}% column 1

|p{\dimexpr.25\linewidth-2\tabcolsep-1.3333\arrayrulewidth}% column 2

|p{\dimexpr.25\linewidth-2\tabcolsep-1.3333\arrayrulewidth}|% column 3

}

\hline

\centering Alpha & \centering Beta & \centering\arraybackslash Gamma \\ \hline

$0$ & 2 & 4 \\ \hline

1 & 3 & $5$ \\ \hline

\end{tabular}

\caption{the caption of table}

\end{table}


\noindent

Text after tabular \\


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

\end{document}


3. Save file as tableAdjustSpaceBeforeAfter1.tex

4. Then build or typeset or compile the Latex code.

Output


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


< Previous Tables In Latex 2


Related Post

Learn About Latex List 1

Tidak ada komentar:

Posting Komentar