Spacing at the top and bottom of tabular
Daniel
xracoonx at gmx.de
Wed Feb 8 08:02:23 UTC 2023
On 2023-02-08 01:51, Dan wrote:
> The code is working just fine, but I need to add something to give a
> little more space at the top and bottom of a table.
>
> Here's the code:
> \begin{tabular}{|c|c|}
> \hline
> \text{Example} & \text{Code} \\
> \hline
> x = \dfrac{-b\pm\sqrt{b^{2}-4ac}}{2a} & \textrm{ x = \backslash
> frac\{-b \backslash pm \backslash sqrt\{ b \hat{} 2 - 4ac\} \}\{2a\} } \\
> \hline
> \end{tabular}
>
> The square root at the top of the box is crushed up into the \hline and
> the 2a at the bottom is similar. I can find all sorts of things to do
> to change horizontal spacing, and I even found a method to add extra
> vertical space to the rows (\arraystretch), but it doesn't do anything
> with the very top and bottom.
>
> A have attached a full file.
>
> Thanks!
> -Dan
Hi Dan,
Is there a specific reason why the table is *inside* a math equation?
I would suggest to use a formal table (attached):
1) Create a table (not inside of an equation)
2) Via the context menu of the table set the style to "Formal Style"
3) Set the border right
4) Add the equation
5) Add the code (and set the font Family via Edit > Text Properties >
Constomize... to Typewriter)
Best,
Daniel
-------------- next part --------------
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass amsart
\begin_preamble
\end_preamble
\use_default_options true
\begin_removed_modules
theorems-ams
\end_removed_modules
\begin_modules
eqs-within-sections
figs-within-sections
theorems-ams-chap-bytype
\end_modules
\maintain_unincluded_children no
\language english
\language_package default
\inputencoding auto-legacy
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_roman_osf false
\font_sans_osf false
\font_typewriter_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\float_placement class
\float_alignment class
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\use_lineno 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 1
\math_indentation 0bp
\math_numbering_side left
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 2
\paperpagestyle default
\tablestyle default
\tracking_changes false
\output_changes false
\change_bars false
\postpone_fragile_content false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\docbook_table_output 0
\docbook_mathml_prefix 1
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="2">
<features booktabs="true" tabularvalignment="middle">
<column alignment="center" valignment="top">
<column alignment="left" valignment="top">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\family roman
\series medium
\shape up
\size normal
\emph off
\nospellcheck off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
Example
\end_layout
\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\family roman
\series medium
\shape up
\size normal
\emph off
\nospellcheck off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
Code
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\begin_inset Formula $x=\dfrac{-b\pm\sqrt{b^{2}-4ac}}{2a}$
\end_inset
\end_layout
\end_inset
</cell>
<cell alignment="left" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\family typewriter
x =
\backslash
frac{-b
\backslash
pm
\backslash
sqrt{b^2 - 4ac}}{2a}
\family default
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document
More information about the lyx-users
mailing list