我正在表格单元格内插入以下文本
\documentclass[a4paper]{book}
\usepackage[latin1]{inputenc}
\usepackage[pdftex, final]{graphicx}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{marvosym}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{color}
\setlength{\tabcolsep}{3pt}
\definecolor{female}{rgb}{1.0,0.2,0.2}
\definecolor{male} {rgb}{0.2,0.2,1.0}
\newcommand{\hgF}[1]{
\begin{description} \parskip0pt \parsep0pt
\itemsep0pt \partopsep0pt
\item[{\color{female}{\Female}}]%
{\color{female}{{\Large {\bf #1}}}}%
\end{description}%
}
\begin{document}
\begin{landscape}
\begin{longtable}{| p{0.4cm} | p{3.5cm} | p{1.8cm} | p{3.2cm} | p{3.5cm} | p{1.8cm} | p{3.2cm} | p{1.8cm} | p{3.2cm} |}
\hline
1 & \hgF{Louise Get} & 01/01/1847 & Revel (Haute-Garonne) & \hgF{Alphonse Martin} & 20/03/1865 & Revel (Haute-Garonne) & 07/10/1951 & Revel (Haute-Garonne) \\ [5pt]
\hline
\end{longtable}
\end{landscape}
\end{document}
我在“FirstName LastName”文本前后留下了太多空白。哪些尺寸可以控制这些额外的间距?
次要问题是,我如何(简单地)避免将其他文本拉伸到列宽(因此我之前使用了 \flushleft 命令!!)。
感谢您的帮助
答案1
\Large
是一个开关,\bf
已弃用,并且\color{female}
不接受参数。因此你需要
\newcommand{\hgF}[1]{%
\begin{description} [nosep,labelwidth=0.75em,leftmargin=\dimexpr\labelwidth+\labelsep,
before=\vspace{-0.7\baselineskip},after=\vspace{-\baselineskip}]
\item[\color{female}\Female]%
{\color{female}\Large\bfseries#1}%
\end{description}%
}
此外,你可能需要有\raggedright
列
\usepackage{array}
\usepackage{ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}
由此,我们有:
\documentclass[a4paper]{book}
\usepackage[latin1]{inputenc}
\usepackage[pdftex, final]{graphicx}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{marvosym}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{color}
\usepackage{enumitem}
\setlength{\tabcolsep}{3pt}
\definecolor{female}{rgb}{1.0,0.2,0.2}
\definecolor{male} {rgb}{0.2,0.2,1.0}
\newcommand{\hgF}[1]{%
\begin{description} [nosep,labelwidth=0.75em,leftmargin=\dimexpr\labelwidth+\labelsep,
before=\vspace{-0.7\baselineskip},after=\vspace{-\baselineskip}]
\item[\color{female}\Female]%
{\color{female}\Large\bfseries#1}%
\end{description}%
}
\usepackage{array}
\usepackage{ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}
\begin{document}
\begin{landscape}
\begin{longtable}{| P{0.4cm} | P{3.5cm} | P{1.8cm} | P{3.2cm} | P{3.5cm} | P{1.8cm} | P{3.2cm} | P{1.8cm} | P{3.2cm} |}
\hline
1 & \hgF{Louise Get} & 01/01/1847 & Revel (Haute-Garonne) & \hgF{Alphonse Martin} & 20/03/1865 & Revel (Haute-Garonne) & 07/10/1951 & Revel (Haute-Garonne) \\ [5pt]
\hline
\end{longtable}
\end{landscape}
\end{document}