Responsive Navbar with Google Search
☰ Menu
Home
Python
LaTeX
GNUPlot
Arduino
Feedback
Contact Us
Creating Tables: Table Formatting
Creating Tables
Table Create
Table Borders
Table Formatting
Table Formatting: Program 1
\documentclass{article} \usepackage{colortbl} \usepackage{xcolor} \title{Colored Rows Table} \date{} \begin{document} \maketitle \begin{tabular}{|c|c|c|} \hline \rowcolor{gray!30} Quantity & Value & Unit \\ \hline Mass & 2 kg & kg \\ \rowcolor{gray!10} Force & 10 N & N \\ Energy & 15 J & J \\ \hline \end{tabular} \end{document}
Run Code
Output 1
Table Formatting: Program 2
\documentclass{article} \usepackage{diagbox} \title{Diagonal Line in Cell Table} \date{} \begin{document} \maketitle \begin{tabular}{|c|c|c|} \hline \diagbox{Measure}{Unit} & Value & Unit \\ \hline Time & 10 & s \\ Distance & 100 & m \\ \hline \end{tabular} \end{document}
Run Code
Output 2
Table Formatting: Program 3
\documentclass{article} \title{Nested Tables} \date{} \begin{document} \maketitle \begin{tabular}{|c|c|} \hline Item & Details \\ \hline Fruit & \begin{tabular}{c|c} Name & Color \\ \hline Apple & Red \\ Banana & Yellow \\ \end{tabular} \\ \hline Vegetable & \begin{tabular}{c|c} Name & Color \\ \hline Carrot & Orange \\ Spinach & Green \\ \end{tabular} \\ \hline \end{tabular} \end{document}
Run Code
Output 3
Table Formatting: Program 4
\documentclass{article} \usepackage{colortbl} \usepackage{xcolor} \title{Table with Conditional Formatting} \date{} \begin{document} \maketitle \begin{tabular}{|c|c|c|} \hline \rowcolor{gray!20} \textbf{Material} & \textbf{Strength (MPa)} & \textbf{Status} \\ \hline Steel & 250 & \cellcolor{green!20} Strong \\ Aluminum & 150 & \cellcolor{yellow!20} Moderate \\ Wood & 30 & \cellcolor{red!20} Weak \\ \hline \end{tabular} \end{document}
Run Code
Output 4
Table Formatting: Program 5
\documentclass{article} \usepackage{colortbl} \usepackage{xcolor} \title{Table with Color and Row Stripes} \date{} \begin{document} \maketitle \begin{tabular}{|c|c|c|} \hline \rowcolor{blue!20} \textbf{Material} & \textbf{Density (g/cm³)} & \textbf{Usage} \\ \hline \rowcolor{gray!30} Steel & 7.85 & Construction, tools \\ \rowcolor{white} Copper & 8.96 & Electrical wiring \\ \rowcolor{gray!30} Aluminum & 2.70 & Aircraft, packaging \\ \rowcolor{white} Plastic & 1.20 & Containers, insulation \\ \hline \end{tabular} \end{document}
Run Code
Output 5
Table Formatting: Program 6
\documentclass{article} \usepackage{colortbl} \usepackage{xcolor} \title{Table with Color Gradients and Borders} \date{} \begin{document} \maketitle \begin{tabular}{|c|c|c|} \hline \rowcolor{green!40} \textbf{Material} & \textbf{Strength (MPa)} & \textbf{Usage} \\ \hline \rowcolor{green!20} Steel & 250 & Structural components \\ \rowcolor{green!10} Aluminum & 150 & Lightweight structures \\ \hline \end{tabular} \end{document}
Run Code
Output 6