테이블 제목의 열 병합 문제

테이블 제목의 열 병합 문제

두 개의 테이블을 만들려고 합니다. 하나는 두 개의 열이 있고 다른 하나는 세 개의 열이 있습니다. 두 경우 모두 첫 번째 행은 모든 열에 병합된 하나의 셀이어야 합니다. 게다가 이 첫 번째 셀의 내용은 두 줄 이상에 걸쳐 있습니다. 현재 내 솔루션은 다음과 같지만 고정된 열 번호에만 작동합니다.

\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개의 열이 있는 테이블

두 개의 열이 있는 경우:

\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개의 열이 있는 테이블

세 개의 열이 있는 경우.

이 제목 명령을 프로그래밍하여 모든 열 번호에 대해 작동하는 방법을 아는 사람이 있습니까?

또한, 다른 사소한 미학적 문제도 있습니다. 표의 내용이 오른쪽으로 퍼져 있고, 특히 회색 선이 매우 눈에 띄지만 제목이 너무 넓습니다. 이 문제를 해결할 수 있는 방법이 있나요?

이름과 성 사이의 점이 제목에는 표시되지만 첫 번째 행에는 표시되지 않는 이유(예: M. 이름 및 M 이름)를 아는 사람이 있습니까?

마지막으로 여기서는 고정 셀 너비 솔루션이 아직 만족스럽지 않습니다. 열이 오른쪽에 너무 많이 표시됩니다. 누군가 이를 더 예쁘게 만드는 방법에 대한 제안이 있을까요?

도움, 의견, 제안에 정말 감사하겠습니다!

답변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}

데모

관련 정보