Gerenciar espaçamento de texto, equações e tabelas

Gerenciar espaçamento de texto, equações e tabelas

Eu uso setspacepara alterar o espaçamento nos textos.

\usepackage{setspace}
\setstretch{1.435}

O espaçamento nas equações pode ser gerenciado alterando\arraystretch

A abordagem de @egreg emaqui

\usepackage{etoolbox}
\pretocmd{\array}{\renewcommand{\arraystretch}{0.69686}}{}{} % 1/1.435=0.69686

ou a abordagem de @campa emaqui

\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.435}
\everydisplay=\expandafter{\the\everydisplay\setstretch{1.0}}

No entanto, de qualquer forma, o espaçamento entre linhas na tabela é um espaçamento de sinal e não pode ser alterado alterando o valor em \arraystretchou \setstretch.

Prefiro aumentar um pouco o espaçamento entre linhas nas tabelas do que o espaçamento entre sinais. Como eu posso fazer isso?

\documentclass{article}
\usepackage{lipsum} % just for this example
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{setspace}
\setstretch{1.435}

\usepackage{etoolbox}
\pretocmd{\array}{\renewcommand{\arraystretch}{1}}{}{} % increase a little for the row spacing in equations

\begin{document}

\lipsum*[1]

\begin{equation}
    X=\begin{cases}
        \frac{1}{2}, & \text{if $a=1$} \\
        \frac{3}{2} & \text{otherwise}
    \end{cases}
\end{equation}

\begin{table}[htbp]
    \centering
    \caption{Changing the row spacing in the table}
    \begin{tabular}{ c c c }
    \toprule
     cell1 & cell2 & cell3 \\
     \midrule
     cell4 & cell5 & cell6 \\  
     cell7 & cell8 & cell9 \\
     \bottomrule
    \end{tabular}
\end{table}

\end{document}

insira a descrição da imagem aqui

Responder1

Para o espaçamento de equações multilinhas, é possível brincar com o spreadlinesambiente de mathtools. Não funciona com o casesambiente simples, mas você pode usar a variante deste ambiente introduzida por mathtools.

Para tabelas, você pode usar cellspace, que define um espaçamento vertical mínimo na parte superior e inferior das células em colunas com especificador prefixado com a letra S (ou Cse você carregar siunitx). Por último, recomendo carregar o captionpacote, que permite definir o salto entre legenda e flutuação.

Aqui está um exemplo de código exagerado:

\documentclass{article}
\usepackage{lipsum} % just for this example
\usepackage{mathtools, empheq, nccmath}
\usepackage{booktabs, caption}
\captionsetup{skip=20pt}
\usepackage[math]{cellspace}
\renewcommand{\cellspacetoplimit}{10pt}
\renewcommand{\cellspacebottomlimit}{10pt}

\usepackage{etoolbox}
\BeforeBeginEnvironment{equation}{\begin{spreadlines}{20pt}}%{\spreadlines{20pt}}%
\AfterEndEnvironment{equation}{\end{spreadlines}}
\BeforeBeginEnvironment{empheq}{\begin{spreadlines}{20pt}}%{\spreadlines{20pt}}%
\AfterEndEnvironment{empheq}{\end{spreadlines}}

\usepackage{setspace}
\setstretch{1.435}
\pretocmd{\array}{\renewcommand{\arraystretch}{1}}{}{} % increase a little for the row spacing in equations

\begin{document}

\lipsum*[1]
\begin{equation}
    X=\begin{cases*}
        \mfrac{1}{2}, & \text{if $a=1$} \\
        \mfrac{3}{2} & \text{otherwise}
    \end{cases*}
\end{equation}

 \begin{empheq}[left ={ X = \empheqlbrace}]{alignat*=2}
     & \mfrac{1}{2}, &\quad & \text{if $a=1$} \\
      & \mfrac{3}{2} & & \text{otherwise}
\end{empheq}

\begin{table}[htbp]
    \centering
    \caption{Changing the row spacing in the table}
    \begin{tabular}{ Sc c c }
    \toprule
     cell1 & cell2 & cell3 \\
     \midrule
     cell4 & cell5 & cell6 \\
     cell7 & cell8 & cell9 \\
     \bottomrule
    \end{tabular}
\end{table}

\end{document} 

insira a descrição da imagem aqui

informação relacionada