Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The code:

\usepackage{pgf,tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows}
\usepackage{pgfplotstable,booktabs,array,colortbl,multirow}

\newcolumntype{C}{>{\centering\arraybackslash}m{5cm}}
\pgfplotsset{compat=1.5}
\begin{table}[!hbt]
\begin{center}
\pgfplotstabletypeset[
    row sep=\\,
    col sep=&,
    trim cells,
    columns={f(x),f'(x)},
    columns/f(x)/.style={string type, column type={|C|}},
    columns/f'(x)/.style={string type, column type={C|}},
    every nth row={1}{before row=\hline},
    every head row/.style={before row=\hline, after row=\hline},
    every last row/.style={after row=\hline}
]
{
f(x) & f'(x) \\
{$k$} & $0$\\
{$x$} & $1$\\
{$x^{n}$} & $n\cdot x^{n-1}$\\
{$u^{n}$} & $n\cdot x^{n-1}\cdot u^{'}$\\
{$\sqrt{x}$} & $\dfrac{1}{2\sqrt{x}}$\\
{$\sqrt[n]{u}$} & $\cfrac{u^{'}}{n\sqrt[n-1]{u^{n-1}}}$\\
{$\ln u$} & $\dfrac{u^{'}}{u}$\\
{$\log_{a}u$} & $\dfrac{u^{'}}{u}\cdot\dfrac{1}{\ln a}$\\
{$a^{u}$} & $a^{u}\cdot u^{'}\cdot\ln a$\\
{$e^{x}$} & $e^{x}$\\
{$e^{u}$} & $e^{x}\cdot u^{'}$\\
{$\sin u$} & $\cos u\cdot u^{'}$\\
{$\cos u$} & $-\sin u\cdot u^{'}$\\
{$\tan u$} & $\dfrac{u^{'}}{\cos^{2}u}$\\
{$\arcsin u$} & $\dfrac{u^{'}}{\sqrt{1-u^{2}}}$\\
{$\arccos u$} & $-\dfrac{u^{'}}{\sqrt{1-u^{2}}}$\\
{$\arctan u$} & $\dfrac{u^{'}}{1+u^{2}}$\\
{$\sinh u$} & $u^{'}\cdot\cosh u$\\
{$\cosh u$} & $u^{'}\cdot\sinh u$\\
{$\tanh u$} & $-u^{'}\cdot cosech^{2}u$\\
{$cosech\: u$} & $-u^{'}\cdot cosech\: u\cdot\coth u$\\
{$sech\: u$} & $-u^{'}\cdot sech u\cdot\tanh u$\\
{$coth\: u$} & $-u^{'}\cdot cosech^{2} u$\\
}
\caption{Tabla De Derivadas}
\end{center}
\end{table}

I want put in blue color to the text in f(x) and f'(x) When I use in a cell a fraction expression, the text touches the bottom line and top line of the cell, How can I increase the high of these cells?

Thanks.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can simplifyt things a little by putting the content in math mode automatically and removing the header row since you have math in the first row

\documentclass{article}
\usepackage{pgfplotstable,booktabs,colortbl,multirow,amsmath}
\newcolumntype{C}{>{\centering\arraybackslash\raisebox{-4mm}{\rule{0pt}{1cm}}}m{5cm}}
\pgfplotsset{compat=1.5}

\begin{document}
\begin{table}
\centering
\pgfplotstabletypeset[
    row sep=\\,
    col sep=&,
    column type=,
    string type,header=false,
    begin table=\begin{tabular}{|C|C|},
    every head row/.style={after row=\hline,output empty row},
    every nth row={1}{before row=\hline},
    every row/.append style={before row=\hline},
    every last row/.style={after row=\hline},
    postproc cell content/.style={/pgfplots/table/@cell content/.add={$\displaystyle}{$}},
]
{
\color{blue}f(x)    & \color{blue}f'(x)                    \\
k                   & 0                                    \\
x                   & 1                                    \\
x^{n}               & n\cdot x^{n-1}                       \\
u^{n}               & n\cdot x^{n-1}\cdot u'               \\
\sqrt{x}            & \dfrac{1}{2\sqrt{x}}                 \\
\sqrt[n]{u}         & \cfrac{u'}{n\sqrt[n-1]{u^{n-1}}}     \\
\ln u               & \dfrac{u'}{u}                        \\
\log_{a}u           & \dfrac{u'}{u}\cdot\dfrac{1}{\ln a}   \\
a^{u}               & a^{u}\cdot u'\cdot\ln a              \\
e^{x}               & e^{x}                                \\
}
\caption{Tabla De Derivadas}
%\end{center}
\end{table}
\end{document}

enter image description here

share|improve this answer
    
Thank you very much, it works very fine and you've solved the problem with math expressions too.I've added [!hbt] in \begin{table} because i have got some text before the table, and now the table appears after this text. Thank you very much! –  Tobal Aug 28 '13 at 7:19
    
@user1792344 My pleasure –  percusse Aug 28 '13 at 8:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.