\midrule 在 booktabs 中以虚线和彩色显示 - 在一个 booktab 中显示两种 midrule

\midrule 在 booktabs 中以虚线和彩色显示 - 在一个 booktab 中显示两种 midrule

是否可以\midrule在一个书本标签中制作两个 s?第一个应该是彩色的,第二个应该是彩色和虚线的,如图所示。每个条目前都有一个水平空格 - 如何在表格中包含这样的空格?

输出应有

\documentclass{beamer}          

\mode<presentation>
{   \usetheme{Madrid}
    \setbeamercovered{transparent}
}

\usepackage{booktabs}

\usepackage{amsmath}
\usepackage{amsfonts}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}

\usepackage[utf8x]{inputenc}
\usepackage[MeX]{polski}

\usepackage{tabularx}
\usepackage{color}
\usepackage{graphicx}

\usepackage[utopia]{mathdesign}

\usecolortheme{crane}

\renewcommand\figurename{Rys.}
\def\captionlabeldelim{.}

\renewcommand\tablename{Tab.}
\def\captionlabeldelim{.}
\usepackage[small,bf,singlelinecheck=off]{caption}

\title[Midrule]
{\textbf{midrule}\\ colored and dashed}
\subtitle{}
\author[]{No name}
\institute[Boo]
{    }
\date[19.10.12]
{\\ }

\subject{Foo}
\AtBeginSection[]
{ \begin{frame}<beamer>
   \frametitle{Plan}
   \tableofcontents[currentsection]
  \end{frame}
}

\begin{document}
\begin{frame}
\begin{center}
\begin{table}
\begin{tabular}{@{}m{\dimexpr.45\textwidth}ccc@{}}
\toprule
procesy & Min & Max  & Else\\
\midrule
Junior         & 1 000 & 2 800 & 4 500\\
\midrule
Senior         &  & ? &\\
\midrule 
Specjalist     &  & ? &\\
\midrule
Team Leader    &  & ? &\\
\bottomrule
\end{tabular}
\caption{1. Caption}
\label{tabela1}
\end{table}
\end{center}
\end{frame}
\end{document}

答案1

您可以使用tabu改为包:

\documentclass{beamer}          
\usepackage{tabu}

\begin{document}

\begin{frame}
\begin{table}
\tabulinesep =_4pt^4pt
\begin{tabu}to \textwidth{@{}cX[m]ccc@{}}
  \tabucline[1pt blue!40 off 0pt]{-}
  \multicolumn{2}{@{}l}{procesy} & Min & Max  &Dalkia\\
  \tabucline[0.7pt blue!40 off 0pt]{-}
  & Junior         & 1 700 & 2 800 & 3 200\\
  \tabucline[0.4pt blue!40 off 2pt]{-}
  & Senior         &  & ? &\\
  \tabucline[0.4pt blue!40 off 2pt]{-}
  & Specjalist     &  & ? &\\
  \tabucline[0.4pt blue!40 off 2pt]{-}
  & Team Leader    &  & ? &\\
  \tabucline[1pt blue!40 off 0pt]{-}
\end{tabu}
\caption{1. Wynagrodzenia: Procesy HR}
\label{tabela1}
\end{table}
\end{frame}

\end{document}

在此处输入图片描述

答案2

这是一个比较tabuGonzalo 的答案与booktabs。与相比它是可行的tabu,但它并不总是很漂亮。

在此处输入图片描述

\documentclass{article}          
\usepackage{tabu}% http://ctan.org/pkg/tabu
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\makeatletter
\newcommand{\dashrule}[1][black]{%
  \color{#1}\rule[\dimexpr.5ex-.2pt]{4pt}{.4pt}\xleaders\hbox{\rule{4pt}{0pt}\rule[\dimexpr.5ex-.2pt]{4pt}{.4pt}}\hfill\kern0pt%
}
\newcommand{\rulecolor}[1]{%
  \def\CT@arc@{\color{#1}}%
}
\makeatother
\begin{document}

\begin{table}[t]
\tabulinesep =_4pt^4pt
\begin{tabu}to \textwidth{@{}cX[m]X[c]X[c]X[c]@{}}
  \tabucline[1pt blue!40 off 0pt]{-}
  \multicolumn{2}{@{}l}{procesy} & Min & Max  &Dalkia\\
  \tabucline[0.7pt blue!40 off 0pt]{-}
  & Junior         & 1 700 & 2 800 & 3 200\\
  \tabucline[0.4pt blue!40 off 2pt]{-}
  & Senior         &  & ? &\\
  \tabucline[0.4pt blue!40 off 2pt]{-}
  & Specjalist     &  & ? &\\
  \tabucline[0.4pt blue!40 off 2pt]{-}
  & Team Leader    &  & ? &\\
  \tabucline[1pt blue!40 off 0pt]{-}
\end{tabu}

\bigskip

\rulecolor{blue!40}
\begin{tabularx}{\linewidth}{X>{\centering}X>{\centering}X>{\centering\arraybackslash}X@{}}
  \toprule
  procesy & Min & Max & Delta \\
  \midrule
  Junior & 1\,700 & 2\,800 & 3\,200 \\[-\jot]
  \multicolumn{4}{@{}c@{}}{\makebox[\linewidth]{\dashrule[blue!40]}} \\[-\jot]
  Senior         &  & ? &\\
  \multicolumn{4}{@{}c@{}}{\makebox[\linewidth]{\dashrule[blue!40]}} \\[-\jot]
  Specjalist     &  & ? &\\
  \multicolumn{4}{@{}c@{}}{\makebox[\linewidth]{\dashrule[blue!40]}} \\[-\jot]
  Team Leader    &  & ? &\\
  \bottomrule
\end{tabularx}
\caption{1. Wynagrodzenia: Procesy HR}
\end{table}

\end{document}

指某东西的用途tabularx可以方便地指定tabular宽度。规则颜色使用 指定\rulecolor{<color>},虚线规则颜色使用 指定\dashrule[<color>]

答案3

您可以使用{NiceTabular}( nicematrix≥ 6.11 ,2022-07-16) 来做到这一点。

\documentclass{beamer}          
\usepackage{nicematrix,tikz,booktabs}

\begin{document}

\begin{frame}
\begin{table}
\NiceMatrixOptions
  {
    custom-line = 
     {
       command = dashedmidrule ,
       tikz = { dashed , color = blue!40 } ,
       total-width = \pgflinewidth + \aboverulesep + \belowrulesep ,
     }
  }

\begin{NiceTabular}{@{}cX[m]ccc@{}}[rules/color=blue!40]
  \toprule
  \Block[l]{1-2}{procesy} && Min & Max  &Dalkia\\
  \midrule
  & Junior         & 1 700 & 2 800 & 3 200\\
  \dashedmidrule
  & Senior         &  & ? &\\
  \dashedmidrule
  & Specjalist     &  & ? &\\
  \dashedmidrule
  & Team Leader    &  & ? &\\
  \bottomrule
\end{NiceTabular}
\caption{1. Wynagrodzenia: Procesy HR}
\label{tabela1}
\end{table}
\end{frame}

\end{document}

您需要多次编译(因为nicematrix在后台使用 PGF/Tikz 节点)。

上述代码的输出

答案4

使用该包的变体tabularray

\documentclass{beamer}          

\mode<presentation>
{   \usetheme{Madrid}
    \setbeamercovered{transparent}
}

\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
\begin{frame}
\begin{table}
\begin{tblr}{
  colspec={@{}Xccc@{}},
  hline{1,Z} = {2pt,blue!20!lightgray},
  hline{2} = {1pt,blue!20!lightgray},
  hline{3-Y} = {dashed,gray},
  cell{2-Z}{1} = {preto={\quad}}
}
procesy & Min & Max  & Else\\
Junior         & 1 000 & 2 800 & 4 500\\
Senior         &  & ? &\\
Specjalist     &  & ? &\\
Team Leader    &  & ? &\\
\end{tblr}
\caption{1. Caption}
\label{tabela1}
\end{table}
\end{frame}
\end{document}

在此处输入图片描述

相关内容