表の見出しの列を結合することによる問題

表の見出しの列を結合することによる問題

私は 2 つのテーブルを作成しようとしています。1 つは 2 列、もう 1 つは 3 列です。どちらの場合も、最初の行はすべての列を結合した 1 つのセルである必要があります。また、この最初のセルの内容は複数の行にまたがっています。これが現時点での私の解決策ですが、これは固定された列番号に対してのみ機能します。

\documentclass{scrreprt}

\usepackage{booktabs} 

\usepackage{tabularx} 
\newcolumntype{b}{X} %type big
\newcolumntype{s}{>{\hsize=0.99\hsize}X} %type small. Above 1 does not make any difference
\newcommand{\heading}[1]{\multicolumn{2}{p{\textwidth}}{#1}} %For the cases where I am main author
%\newcommand{\heading}[1]{\multicolumn{3}{p{\textwidth}}{#1}} %For the cases where I am not main author

\usepackage[table,xcdraw]{xcolor}
\renewcommand{\arraystretch}{1.2} %(or 1.3). based on the advice in https://www.inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf

\usepackage{csquotes} 

\usepackage{siunitx} 
\sisetup{detect-all} 

\usepackage{pifont} 
\newcommand{\xmark}{\ding{55}} 

\begin{document}
This is my template for tables: documentation of authorship for the cumulative thesis.
\begin{table}[h!]
\centering
%\caption{My caption}
%\label{my-label}
\begin{tabularx}{\textwidth}{bs}
\toprule %requires the booktabs package.
%\multicolumn{2}{p{\textwidth}}{[ref] M. Name and L. Author, \enquote{Long title of a nice article reporting cool but complicated research}, \textit{Fancy journal} \textbf{2016}, \textit{13}, 001--007}  \\
\heading{[ref] M. Name and L. Author, \enquote{Long title of a nice article     reporting cool but complicated research} \textbf{2016}, \textit{13}, 001--007}\\
\midrule
Author                          & M. Name \\
\midrule %requires the booktabs package
Development of the concept      & \xmark   \\
\rowcolor[HTML]{C0C0C0} 
Preparation of the figures      & \xmark  \\ 
Preparation of the manuscript   & \xmark  \\ %\cmark \xmark require the pifont package and newcommand thing: http://tex.stackexchange.com/questions/42619/x-mark-to-match-checkmark 
\rowcolor[HTML]{C0C0C0} 
Correction of the manuscript    & \xmark   \\
\midrule 
Proposed publication equivalent & \num{1}  \\
\bottomrule     
\end{tabularx}
\end{table}

\end{document}

2列の表

2つの列がある場合:

\documentclass{scrreprt}

\usepackage{booktabs} 

\usepackage{tabularx} 
\newcolumntype{b}{X} %type big
\newcolumntype{s}{>{\hsize=0.99\hsize}X} %type small. Above 1 does not make any difference
%\newcommand{\heading}[1]{\multicolumn{2}{p{\textwidth}}{#1}} %For the cases where I am main author
\newcommand{\heading}[1]{\multicolumn{3}{p{\textwidth}}{#1}} % For the cases where I am not main author

\usepackage[table,xcdraw]{xcolor}
\renewcommand{\arraystretch}{1.2} %(or 1.3). based on the advice in https://www.inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf

\usepackage{csquotes}

\usepackage{siunitx} %possible package for units
\sisetup{detect-all} 

\usepackage{pifont} 
\newcommand{\xmark}{\ding{55}} 

\begin{document}

This is my template for tables: documentation of authorship for the cumulative thesis.

\begin{table}[h!]
\centering
%\caption{My caption}
%\label{my-label}
\begin{tabularx}{\textwidth}{bss}
\toprule 
%\multicolumn{3}{p{\textwidth}}{[ref] F. Author, M. Name and L. Author,         \enquote{Long title of a nice article reporting cool but complicated research}, \textit{Fancy journal} \textbf{2016}, \textit{13}, 001--007}  \\
\heading{[ref] F. Author, M. Name and L. Author, \enquote{Long title of a nice article reporting cool but complicated research}, \textit{Fancy journal}     \textbf{2016}, \textit{13}, 001--007}\\
\midrule
Author                          & F. Author & M. Name \\
\midrule 
Development of the concept      & \xmark  & \\
\rowcolor[HTML]{C0C0C0} 
Programmation of the algorithm  & \xmark & \xmark  \\ 
Data acquisition                & \xmark &  \\
\rowcolor[HTML]{C0C0C0} 
Data analysis                   & \xmark & \xmark \\ 
Preparation of the manuscript   & \xmark & \\ %\cmark \xmark require the pifont package and newcommand thing: http://tex.stackexchange.com/questions/42619/x-mark-to-match-checkmark 
\rowcolor[HTML]{C0C0C0} 
Correction of the manuscript    & \xmark  & \xmark  \\
\midrule 
Proposed publication equivalent & \num{1} & \num{0,5} \\
\bottomrule     
\end{tabularx}
\end{table}

\end{document}

3列の表

3列の場合。

この見出しコマンドを任意の列番号で動作するようにプログラムする方法を知っている人はいますか?

また、他にも小さな美観上の問題があります。表の内容が右側に広がっており、特に灰色の線が非常に目立ちますが、タイトルも幅が広すぎます。これを修正する方法はありますか?

名と姓の間の点が見出しでは表示されるのに、最初の行では表示されないのはなぜか (M. Name と M Name のように) わかる人はいますか?

最後に、ここでの固定セル幅ソリューションにはまだ満足していません。列が右側に寄ってしまいます。もっときれいにする方法について、誰か提案がありますか?

ご協力、コメント、ご提案をいただければ大変ありがたく思います。

答え1

使用されているすべてのパッケージに詳しいわけではないので、ピリオドが消えた原因はわかりません。原因が何であれ、s の代わりに c を使用すると問題は解決しました。

\documentclass{scrreprt}

\usepackage{booktabs} 

\usepackage{tabularx} 
\newcolumntype{b}{X} %type big
%\newcolumntype{s}{>{\hsize=0.99\hsize}X} %type small. Above 1 does not make any difference
%\newcommand{\heading}[1]{\multicolumn{2}{p{\textwidth}}{#1}} %For the cases where I am main author
\newcommand{\heading}[1]{\multicolumn{3}{p{\dimexpr\textwidth-2\tabcolsep}}{#1}} % For the cases where I am not main author

\usepackage[table,xcdraw]{xcolor}
\renewcommand{\arraystretch}{1.2} %(or 1.3). based on the advice in https://www.inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf

\usepackage{csquotes}

\usepackage{siunitx} %possible package for units
\sisetup{detect-all} 

\usepackage{pifont} 
\newcommand{\xmark}{\ding{55}} 

\begin{document}

This is my template for tables: documentation of authorship for the cumulative thesis.

\begin{table}[h!]
\centering
%\caption{My caption}
%\label{my-label}
\begin{tabularx}{\textwidth}{bcc}
\toprule 
%\multicolumn{3}{p{\textwidth}}{[ref] F. Author, M. Name and L. Author,         \enquote{Long title of a nice article reporting cool but complicated research}, \textit{Fancy journal} \textbf{2016}, \textit{13}, 001--007}  \\
\heading{[ref] F. Author, M. Name and L. Author, \enquote{Long title of a nice article reporting cool but complicated research}, \textit{Fancy journal}     \textbf{2016}, \textit{13}, 001--007}\\
\midrule
Author                          & F. Author & M. Name \\
\midrule 
Development of the concept      & \xmark  & \\
\rowcolor[HTML]{C0C0C0} 
Programmation of the algorithm  & \xmark & \xmark  \\ 
Data acquisition                & \xmark &  \\
\rowcolor[HTML]{C0C0C0} 
Data analysis                   & \xmark & \xmark \\ 
Preparation of the manuscript   & \xmark & \\ %\cmark \xmark require the pifont package and newcommand thing: http://tex.stackexchange.com/questions/42619/x-mark-to-match-checkmark 
\rowcolor[HTML]{C0C0C0} 
Correction of the manuscript    & \xmark  & \xmark  \\
\midrule 
Proposed publication equivalent & \num{1} & \num{0,5} \\
\bottomrule     
\end{tabularx}
\end{table}

\end{document}

デモ

関連情報