TransWikia.com

Editing a tabular:

TeX - LaTeX Asked by Med-Elf on September 11, 2020

So I have been working on an article about integration and its techniques, and at the ending I decided to add a tabular contains the most frequently functions and its antiderivatives, but the problem is that it looks ugly (lol), so any suggests to make it look fancier?
Here’s the ugly tablar:

    begin{tabular}{|c|c|c|}
hline 
$mathbb{R}_+^*$ & $x^n $ & $frac{x^{n+1}}{n+1}+c$  
hline 
$mathbb{R}^*$ & $frac{1}{x}$ & $ln vert xvert +c$  
hline 
$mathbb{R}$ & $e^{lambda x}$ & $frac{1}{lambda}e^x+c$  
hline 
$mathbb{R}$ & $a^{lambda x} $ & $frac{a^x}{ln(a)}+c$  
hline 
$mathbb{R}$ & $cos (omega x) $ & $frac{1}{omega}sin(omega x)+c$  
hline 
$mathbb{R}$ & $sin (omega x) $ & $frac{1}{omega} cos(omega x)+c$  
hline 
$]frac{-pi}{2} ,frac{pi}{2}[$ & $tan x$ & $-ln vert cos xvert +c$  
hline 
$]frac{-pi}{2} ,frac{pi}{2}[$ & $1+tan ^2 x  text{ou}  frac{1}{cos^2 x}$ & $tan x +c$  
hline 
$]0,pi[$ & $frac{1}{sin^2 x}$ & $-frac{1}{tan x}+c$  
hline 
$mathbb{R}$ & $cosh (omega x) $ & $frac{1}{omega} sinh (omega x)+c$  
hline 
$mathbb{R}$ & $sinh (omega x)$ & $frac{1}{omega x} cosh (omega x)+c$  
hline 
$mathbb{R}$ & $tanh (omega x)$ & $lnleft(cosh xright)+c$  
hline 
$mathbb{R}$ & $frac{1}{cosh^2 x}  text{ou} 1-tanh^2 x$ & $tanh x+c$  
hline 
$mathbb{R}^*$ & $frac{1}{sinh^2 x}$ & $-frac{1}{tanh x}+c$  
hline 
$mathbb{R}$ & $frac{1}{1+x^2}$  & $arctan x+c$  
hline 
$]-1,1[$ & $frac{1}{sqrt{1-x^2}}$ & $arcsin x +c$  
hline 
$]-1,1[$ & $frac{1}{1-x^2}$ & $tanh^{-1} x+c$  
hline 
$mathbb{R}$ & $frac{1}{sqrt{x^2+1}}$ & $sinh ^{-1} x+c$  
hline 
$[1,+infty [$ & $frac{1}{sqrt{x^2-1}}$ & $cosh^{-1} x+c$  
hline 
end{tabular} 

enter image description here

Any edits or suggests to update it? I’ll be thankful!

3 Answers

  • you not provide any information about your document and its page layout, so the following solution use `article˛document class and its default page layout
  • For fractions I would use mfrac, a medium size fractions defined int the package nccmath
  • for more vertical space around cells content I would employ macro setcellgapes defined in the makecell package
  • Instead of tabular is better touse array environment inside math environment. By this all $ around math terms should be removed.

Edit:

  • In the first version the content of the first table cell was centered due use of macro makegapedcells.
  • So far I didn't figured out why, however with use makecell[l]{...} this misalignment can be corrected:
documentclass{article}
usepackage{amssymb, nccmath}
usepackage{makecell}

begin{document}
    [
setcellgapes{3pt}
makegapedcells
begin{array}{|l|l|l|}
hline
makecell[l]{mathbb{R}_+^*} % <---
                & x^n  & mfrac{x^{n+1}}{n+1}+c 
hline
mathbb{R}^*    & mfrac{1}{x} & ln vert xvert +c 
hline
mathbb{R}      & e^{lambda x} & mfrac{1}{lambda}e^x+c 
hline
mathbb{R}      & a^{lambda x}  & mfrac{a^x}{ln(a)}+c 
hline
mathbb{R}      & cos(omega x)  & mfrac{1}{omega}sin(omega x)+c 
hline
mathbb{R}      & sin(omega x)  & mfrac{1}{omega} cos(omega x)+c 
hline
]mfrac{-pi}{2} ,mfrac{pi}{2}[
                & tan x & -ln vert cos xvert +c 
hline
]mfrac{-pi}{2} ,mfrac{pi}{2}[
                & 1+tan ^2 x  text{ou}  mfrac{1}{cos^2 x} & tan x +c 
hline
]0,pi[ & mfrac{1}{sin^2 x}
                & -mfrac{1}{tan x}+c 
hline
mathbb{R}      & cosh (omega x)  & mfrac{1}{omega} sinh (omega x)+c 
hline
mathbb{R}      & sinh (omega x) & mfrac{1}{omega x} cosh (omega x)+c 
hline
mathbb{R}      & tanh (omega x) & lnleft(cosh xright)+c 
hline
mathbb{R}      & mfrac{1}{cosh^2 x}  text{ou} 1-tanh^2 x & tanh x+c 
hline
mathbb{R}^*    & mfrac{1}{sinh^2 x} & -mfrac{1}{tanh x}+c 
hline
mathbb{R}      & mfrac{1}{1+x^2}  & arctan x+c 
hline
]-1,1[          & mfrac{1}{sqrt{1-x^2}} & arcsin x +c 
hline
]-1,1[          & mfrac{1}{1-x^2} & tanh^{-1} x+c 
hline
mathbb{R}      & mfrac{1}{sqrt{x^2+1}} & sinh ^{-1} x+c 
hline
[1,+infty [    & mfrac{1}{sqrt{x^2-1}} & cosh^{-1} x+c 
hline
end{array}
    ]
endgroup
end{document}

enter image description here

Correct answer by Zarko on September 11, 2020

I thought of expanding the space of the table cells and aligning the first column on the left so that the real fields are correctly columned.

documentclass[a4paper,12pt]{article}
usepackage{amsmath}
usepackage{amssymb}

begin{document}
If $cin mathbb{R}$:
setlength{tabcolsep}{18pt}
renewcommand{arraystretch}{1.5}
begin{tabular}{|l|c|c|}
hline 
$mathbb{R}_+^*$ & $x^n $ & $frac{x^{n+1}}{n+1}+c$  
hline 
$mathbb{R}^*$ & $frac{1}{x}$ & $ln vert xvert +c$  
hline 
$mathbb{R}$ & $e^{lambda x}$ & $frac{1}{lambda}e^x+c$  
hline 
$mathbb{R}$ & $a^{lambda x} $ & $frac{a^x}{ln(a)}+c$  
hline 
$mathbb{R}$ & $cos (omega x) $ & $frac{1}{omega}sin(omega x)+c$  
hline 
$mathbb{R}$ & $sin (omega x) $ & $frac{1}{omega} cos(omega x)+c$  
hline 
$]-frac{pi}{2} ,frac{pi}{2}[$ & $tan x$ & $-ln vert cos xvert +c$  
hline 
$]-frac{pi}{2} ,frac{pi}{2}[$ & $1+tan ^2 x  text{ou}  frac{1}{cos^2 x}$ & $tan x +c$  
hline 
$]0,pi[$ & $frac{1}{sin^2 x}$ & $-frac{1}{tan x}+c$  
hline 
$mathbb{R}$ & $cosh (omega x) $ & $frac{1}{omega} sinh (omega x)+c$  
hline 
$mathbb{R}$ & $sinh (omega x)$ & $frac{1}{omega x} cosh (omega x)+c$  
hline 
$mathbb{R}$ & $tanh (omega x)$ & $lnleft(cosh xright)+c$  
hline 
$mathbb{R}$ & $frac{1}{cosh^2 x}  text{ou} 1-tanh^2 x$ & $tanh x+c$  
hline 
$mathbb{R}^*$ & $frac{1}{sinh^2 x}$ & $-frac{1}{tanh x}+c$  
hline 
$mathbb{R}$ & $frac{1}{1+x^2}$  & $arctan x+c$  
hline 
$]-1,1[$ & $frac{1}{sqrt{1-x^2}}$ & $arcsin x +c$  
hline 
$]-1,1[$ & $frac{1}{1-x^2}$ & $tanh^{-1} x+c$  
hline 
$mathbb{R}$ & $frac{1}{sqrt{x^2+1}}$ & $sinh ^{-1} x+c$  
hline 
$[1,+infty [$ & $frac{1}{sqrt{x^2-1}}$ & $cosh^{-1} x+c$  
hline 
end{tabular} 
end{document}

enter image description here

Answered by Sebastiano on September 11, 2020

One more (mine) solution. Because it is based on the (very) old mdwtab, almost forgotten package mdwtab I decide to write new answer. It has a features which make it very handy (to my opinion) for such tables as is OP ones:

  • Define columns type dedicated for math content (Ml, Mc and Mr).
  • Define horizontal lines hlx{...}, where in ˙... are parameters (in MWE below are used v and h, for others see packet documentation} defining vertical space above and below line so that vertical lines aren't interrupted:
documentclass{article}
usepackage{amssymb, nccmath}
usepackage{mdwtab}

begin{document}
    begin{center}
    setlengthtabcolsep{9pt}
begin{tabular}{|Ml|Ml|Ml|}  % <---
    hlx{hv}                 % <---
mathbb{R}_+^* 
                & x^n  & mfrac{x^{n+1}}{n+1}+c 
    hlx{vhv}                % <---
mathbb{R}^*    & mfrac{1}{x} & ln vert xvert +c 
    hlx{vhv}
mathbb{R}      & e^{lambda x} & mfrac{1}{lambda}e^x+c 
    hlx{vhv}
mathbb{R}      & a^{lambda x}  & mfrac{a^x}{ln(a)}+c 
    hlx{vhv}
mathbb{R}      & cos(omega x)  & mfrac{1}{omega}sin(omega x)+c 
    hlx{vhv}
mathbb{R}      & sin(omega x)  & mfrac{1}{omega} cos(omega x)+c 
    hlx{vhv}
]mfrac{-pi}{2} ,mfrac{pi}{2}[
                & tan x & -ln vert cos xvert +c 
    hlx{vhv}
]mfrac{-pi}{2} ,mfrac{pi}{2}[
                & 1+tan^2 x  text{ou} mfrac{1}{cos^2 x} & tan x +c 
    hlx{vhv}
]0,pi[ & mfrac{1}{sin^2 x}
                & -mfrac{1}{tan x}+c 
    hlx{vhv}
mathbb{R}      & cosh (omega x)  & mfrac{1}{omega} sinh (omega x)+c 
    hlx{vhv}
mathbb{R}      & sinh (omega x) & mfrac{1}{omega x} cosh (omega x)+c 
    hlx{vhv}
mathbb{R}      & tanh (omega x) & lnleft(cosh xright)+c 
    hlx{vhv}
mathbb{R}      & mfrac{1}{cosh^2 x}  text{ou} 1-tanh^2 x & tanh x+c 
    hlx{vhv}
mathbb{R}^*    & mfrac{1}{sinh^2 x} & -mfrac{1}{tanh x}+c 
    hlx{vhv}
mathbb{R}      & mfrac{1}{1+x^2}  & arctan x+c 
    hlx{vhv}
]-1,1[          & mfrac{1}{sqrt{1-x^2}} & arcsin x +c 
    hlx{vhv}
]-1,1[          & mfrac{1}{1-x^2} & tanh^{-1} x+c 
    hlx{vhv}
mathbb{R}      & mfrac{1}{sqrt{x^2+1}} & sinh ^{-1} x+c 
    hlx{vhv}
[1,+infty [    & mfrac{1}{sqrt{x^2-1}} & cosh^{-1} x+c 
    hlx{vh}                 % <---
end{tabular}
    end{center}
end{document}

enter image description here

Answered by Zarko on September 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP