### Complete Example Document Source: https://context7.com/josselinnoirel/cellspace/llms.txt A full working example demonstrating multiple cellspace features including custom spacing, paragraph column registration, and integration with booktabs and amsmath. ```latex \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[a4paper, margin=1in]{geometry} \usepackage{amsmath} \usepackage[math]{cellspace} \usepackage{booktabs} \usepackage{tabularx} % Configure spacing limits \setlength{\cellspacetoplimit}{3pt} \setlength{\cellspacebottomlimit}{3pt} % Register tabularx column type \addparagraphcolumntypes{X} \begin{document} \section{Scientific Data Table} \begin{tabular}{Sl Sc Sc} \toprule \textbf{Quantity} & \textbf{Symbol} & \textbf{Value} \\ \midrule Euler's number & $e$ & $\displaystyle \sum_{n=0}^{\infty} \frac{1}{n!}$ \\ Pi & $\pi$ & $\displaystyle 4\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}$ \\ Golden ratio & $\phi$ & $\displaystyle \frac{1+\sqrt{5}}{2}$ \\ \bottomrule \end{tabular} \section{Matrix Example} \[ A = \begin{pmatrix} \frac{1}{2} & \frac{1}{3} & \frac{1}{4} \\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{8} & \frac{1}{9} & \frac{1}{10} \end{pmatrix} \] \section{Wide Table with Tabularx} \begin{tabularx}{\textwidth}{Sl Sc SX} \hline \textbf{Term} & \textbf{Formula} & \textbf{Description} \\ \hline Integral & $\displaystyle \int_a^b f(x)\,dx$ & The definite integral represents the signed area under the curve \\ \hline \end{tabularx} \end{document} ``` -------------------------------- ### Cellspace with Booktabs Package Source: https://context7.com/josselinnoirel/cellspace/llms.txt Cellspace integrates with the booktabs package for professional tables. This example uses \\toprule, \\midrule, and \\bottomrule with the 'Sc' column type. ```latex \documentclass{article} \usepackage{cellspace} \usepackage{booktabs} \usepackage{amsmath} \setlength{\cellspacetoplimit}{2pt} \setlength{\cellspacebottomlimit}{2pt} \begin{document} \begin{tabular}{@{} Sc @{}} \toprule \textit{Formula} \\ \midrule $\displaystyle e = 1 + \frac{1}{2} + \frac{1}{6} + \cdots + \frac{1}{k!} + \cdots$ \\ $\displaystyle \pi = 4 \left( 1 - \frac{1}{3} + \frac{1}{5} + \cdots \right)$ \\ \bottomrule \end{tabular} \end{document} ``` -------------------------------- ### Paragraph Columns with Cellspace Source: https://context7.com/josselinnoirel/cellspace/llms.txt For paragraph columns (p, m, b), wrap the column specification in braces like S{p{width}}. This example demonstrates proper spacing with long text and mixed column types. ```latex \documentclass{article} \usepackage{cellspace} \usepackage{amsmath} \setlength{\cellspacetoplimit}{2pt} \setlength{\cellspacebottomlimit}{2pt} \begin{document} % Paragraph column without cellspace - content touches rules \begin{tabular}{p{5cm}} \hline $\displaystyle \frac{1}{2}$ Some long text that wraps across multiple lines in the cell $\displaystyle \frac{1}{2}$ \\ \hline \end{tabular} % Paragraph column with cellspace - proper spacing \begin{tabular}{S{p{5cm}}} \hline $\displaystyle \frac{1}{2}$ Some long text that wraps across multiple lines in the cell $\displaystyle \frac{1}{2}$ \\ \hline \end{tabular} % Mixed columns: regular and paragraph \begin{tabular}{Sl Sl S{p{3cm}}} \hline Name & Value & Description \\ \hline Alpha & $\dfrac{1}{2}$ & A detailed explanation \\ \hline \end{tabular} \end{document} ``` -------------------------------- ### Basic Table with S Column Modifier Source: https://context7.com/josselinnoirel/cellspace/llms.txt Apply the 'S' modifier to column types (l, c, r) to enable automatic spacing. This example shows a comparison between a standard column and an 'Sc' column with fractions. ```latex \documentclass{article} \usepackage{cellspace} \usepackage{amsmath} \setlength{\cellspacetoplimit}{2pt} \setlength{\cellspacebottomlimit}{2pt} \begin{document} % Without cellspace - fractions touch the hlines \begin{tabular}{c} \hline $\displaystyle \frac{1}{2}$ \\ \hline \end{tabular} % With cellspace - proper spacing added automatically \begin{tabular}{Sc} \hline $\displaystyle \frac{1}{2}$ \\ \hline \end{tabular} % Multiple columns with cellspace \begin{tabular}{Sc Sc} \hline \textit{Bond} & \textit{Distance (\AA)} \\ \hline C--C & $1.53$ \\ C--H & $1.10$ \\ \hline \end{tabular} \end{document} ``` -------------------------------- ### Custom Column Modifier Name Source: https://context7.com/josselinnoirel/cellspace/llms.txt Use the `column` option to specify a different modifier name if `S` conflicts with other packages. Examples show usage with `O` as the custom modifier. ```latex \documentclass{article} % Use O instead of S as the column modifier \usepackage[column=O]{cellspace} \setlength{\cellspacetoplimit}{2pt} \setlength{\cellspacebottomlimit}{2pt} \begin{document} % Now use O prefix instead of S \begin{tabular}{Oc Oc Oc} \hline A & B & C \\ \hline $\dfrac{1}{2}$ & $\dfrac{1}{3}$ & $\dfrac{1}{4}$ \\ \hline \end{tabular} % Paragraph columns also use O \begin{tabular}{Ol O{p{4cm}}} \hline Label & Description text here \\ \hline \end{tabular} \end{document} ``` -------------------------------- ### Matrix Spacing with [math] Option Source: https://context7.com/josselinnoirel/cellspace/llms.txt Load cellspace with the `[math]` option to automatically improve spacing in amsmath matrix environments. Set spacing limits using \setlength. ```latex \documentclass{article} \usepackage[math]{cellspace} \setlength{\cellspacetoplimit}{2pt} \setlength{\cellspacebottomlimit}{2pt} \begin{document} % Matrix with automatic cellspace correction \[ \begin{pmatrix} +\frac{1}{2} & +\frac{1}{3} \\ -\frac{1}{3} & +\frac{1}{2} \end{pmatrix} \] % Also works with other matrix types \[ \begin{bmatrix} \dfrac{a}{b} & \dfrac{c}{d} \\ \dfrac{e}{f} & \dfrac{g}{h} \end{bmatrix} \quad \begin{vmatrix} \dfrac{1}{2} & 0 \\ 0 & \dfrac{1}{3} \end{vmatrix} \] \end{document} ``` -------------------------------- ### Load Cellspace Package Source: https://context7.com/josselinnoirel/cellspace/llms.txt Include this in your LaTeX document preamble to load the cellspace package. Use the '[math]' option for matrix support and '[column=O]' to customize the column modifier name. ```latex % Basic usage \usepackage{cellspace} % With math support for matrices \usepackage[math]{cellspace} % With custom column modifier name (instead of S) \usepackage[column=O]{cellspace} ``` -------------------------------- ### Cellspace with Tabularx Package Source: https://context7.com/josselinnoirel/cellspace/llms.txt To use cellspace with tabularx, register the 'X' column type as a paragraph column using \\addparagraphcolumntypes. Load tabularx after cellspace. ```latex \documentclass{article} \usepackage{cellspace} \usepackage{tabularx} \usepackage{amsmath} \setlength{\cellspacetoplimit}{2pt} \setlength{\cellspacebottomlimit}{2pt} % Register X as a paragraph column type for cellspace \addparagraphcolumntypes{X} \begin{document} \begin{tabularx}{\linewidth}{l SX} \hline A & B B B B B B B B \\ A A & B B B B B B B B B B B B B B B B \\ A A A A & $\dfrac{1}{2}$ B B B B B B B B B B B B B B B B $\dfrac{1}{2}$ \\ \hline \end{tabularx} \end{document} ``` -------------------------------- ### Set Cellspace Spacing Limits Source: https://context7.com/josselinnoirel/cellspace/llms.txt Configure the minimum spacing above and below cell content with horizontal rules using \\setlength. Default values are 1pt. ```latex \documentclass{article} \usepackage{cellspace} % Set minimum spacing to 2pt above and below cell content \setlength{\cellspacetoplimit}{2pt} \setlength{\cellspacebottomlimit}{2pt} \begin{document} % Tables will now have at least 2pt spacing when content % would otherwise touch horizontal rules \end{document} ``` -------------------------------- ### Register Custom Paragraph Column Types Source: https://context7.com/josselinnoirel/cellspace/llms.txt Register custom paragraph-type column specifiers for cellspace. Must be called in the document preamble. ```latex \documentclass{article} \usepackage{cellspace} \usepackage{tabularx} % Register X column from tabularx as paragraph type \addparagraphcolumntypes{X} % Register multiple custom column types at once \addparagraphcolumntypes{YZ} \begin{document} % Now SX, SY, SZ will work correctly as paragraph columns \end{document} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.