我正在尝试通过titlesec
包普遍调整我的文本标题。虽然我无法在表格中使用这些标题(subparagraph
就我而言)- 我无法消除过多的垂直间隙:
梅威瑟:
\documentclass[a4paper,fleqn,leqno]{article}
\usepackage{polyglossia}
\usepackage{color,pifont,fontspec}
\usepackage[top=1.5cm,bottom=0cm,left=2cm,right=2cm]{geometry}
\usepackage{changepage}
\usepackage{hyperref,titlesec}
\usepackage{array}
\pagestyle{empty}
\linespread{1}
\newcolumntype{C}[3]{@{\hspace*{#1}}>{\centering\arraybackslash}p{#2}@{\hspace*{#3}}}
\newcolumntype{R}[2]{>{\raggedleft\arraybackslash}p{#1}@{\hspace*{#2}}}
\newcolumntype{L}[2]{@{\hspace*{#1}}>{\raggedright\arraybackslash}p{#2}}
\newcolumntype{"}[1]{@{\vrule width #1}}
\makeatletter\newcommand{\ohline}[1]{\noalign {\ifnum 0=`}\fi\hrule height #1\futurelet\reserved@a\@xhline}\makeatletter
\newlength\savedwidth
\newcommand{\ocline}[2]{\noalign{\global\savedwidth\arrayrulewidth\global\arrayrulewidth #1}\cline{#2}\noalign{\vskip\arrayrulewidth}\noalign{\global\arrayrulewidth\savedwidth}}
\setmainfont{Cambria}
\titleformat{\subparagraph}{\Large\scshape}{}{0pt}{}[]
\titlespacing{\subparagraph}{0pt}{0pt}{0pt}[0pt]
\newenvironment{odstavec}{}{\vspace{25pt}}
\begin{document}
text
\subparagraph{Paragraf}
\begin{odstavec}
text
\end{odstavec}
\begin{tabular}{|L{0pt}{5cm}|L{0pt}{5cm}|}
\hline
\subparagraph{Paragraph} & \subparagraph{Paragraph} \\
\hline
Text in table & Text in table \\
\hline
Text in table & Text in table \\
\hline
\end{tabular}
\end{document}
我只需要手动逐个调整表格中的标题。如何在没有垂直间隙的表格中
使用标题变量(我的意思是例如)?\subparagraph{}
答案1
最好只是定义一个新的宏来格式化列标题,与分段命令分开:
\documentclass[a4paper,fleqn,leqno]{article}
\usepackage{titlesec}
\usepackage{array}
\pagestyle{empty}
\newcolumntype{L}[2]{@{\hspace*{#1}}>{\raggedright\arraybackslash}p{#2}}
\titleformat{\subparagraph}{\Large\scshape}{}{0pt}{}[]
\titlespacing{\subparagraph}{0pt}{0pt}{0pt}[0pt]
\newenvironment{odstavec}{}{\vskip 25pt}
\newcommand*\tabsubparagraph[1]{\textsc{\Large #1}}
\begin{document}
text
\subparagraph{Paragraf}
\begin{odstavec}
text
\end{odstavec}
\begin{tabular}{|L{0pt}{5cm}|L{0pt}{5cm}|}
\hline
\tabsubparagraph{Paragraph} & \tabsubparagraph{Paragraph} \\
\hline
Text in table & Text in table \\
\hline
Text in table & Text in table \\
\hline
\end{tabular}
\end{document}