bidi-tex / xepersian

Persian for LaTeX, using XeTeX
Other
11 stars 1 forks source link

Make first row / column of table all bold. #2

Open davidcarlisle opened 5 years ago

davidcarlisle commented 5 years ago

I have a table with a number of columns and rows in which the title row has both text and math. I'd like to make all of the titles appear in bold shape. Clearly, I can add \textbf or \mathbf, etc. to each of them. However, I'm looking for a nicer way of doing this, particularly for tables with many columns. Tabu package provides \rowfont command which works perfectly with \bfseries and \boldmath as it's font specification. It would be awesome to have a similar command in bidi / xepersian packages to make first row / column of tabular environment.


\documentclass{article}
\usepackage{amsmath}
\usepackage{bm,tabu,array}
\usepackage{xepersian}
\settextfont{Yas}

\newcolumntype{+}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
  #1\ignorespaces
}

\begin{document}

\begin{table}[!h]
\centering
\caption{جدول ساخته شده در محیط \lr{tabular}}
\begin{tabular}{|*{11}{c|}}
\hline
\textbf{صفر}
& یک & دو &
$\bm{\Delta\mu\nabla\sigma}$
& سه & \% & 
\textbf{چهار}
& $\boldsymbol{n=10}$ & $\mathbf{n=15}$ & $\boldsymbol{\Delta\mu\nabla\sigma}$ & $\mathbf{\Delta\mu\nabla\sigma}$
\\ \hline
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \hline
\end{tabular}
\end{table}

\begin{table}[!h]
\caption{جدول ساخته شده در محیط \lr{tabu}}
\centering
\begin{tabu}{|*{11}{c|}}
\hline
\rowfont{\bfseries\boldmath}
صفر & یک & دو & $\Delta\mu\nabla\sigma$ & سه & \% & چهار
& $n=10$ & $n=15$ & $\Delta\mu\nabla\sigma$ & $\Delta\mu\nabla\sigma$
\\ \hline
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \hline
\end{tabu}
\end{table}

\begin{table}[!h]   % https://tex.stackexchange.com/questions/4811
\caption{جدول ساخته شده در محیط \lr{tabular} با دستورات تعریف شده بسته \lr{array}}
\centering
\begin{tabular}{|+c|*{10}{^c|}}
\hline
\rowstyle{\bfseries\boldmath}
صفر & یک & دو & $\Delta\mu\nabla\sigma$ & سه & \% & چهار
& $n=10$ & $n=15$ & $\Delta\mu\nabla\sigma$ & $\Delta\mu\nabla\sigma$
\\ \hline
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \hline
\end{tabular}
\end{table}
اعداد در متن 1234 و در فرمول $1234$
\[ 1 2 3 4 \]
\end{document}

[from sourceforge]

MWE-table-first-row.pdf