删除列表上方的垂直缩进

删除列表上方的垂直缩进

当我在表格中创建项目符号列表时,第一个项目符号与相邻单元格中的文本不对齐。如何删除此缩进,使其水平对齐?

\documentclass[a4paper]{article}

\usepackage{array}
\makeatletter
\newcommand{\compress}{\@minipagetrue}
\makeatother

\usepackage[a4paper,bindingoffset=0.2in,%
            left=2cm,right=2cm,top=2cm,bottom=2cm,%
            footskip=.25in]{geometry}
\usepackage{multicol}
\usepackage{enumitem} % for formatting itemized lists
\usepackage{parskip}
\usepackage{tabularx} % allows for tables to be created by coloumn spacing instead of line spacing as in tabular
\usepackage[dvipsnames]{xcolor}%imports the a colour pallet for things like lines
\usepackage{colortbl} %allows colour fomratting for table lines

\setlength{\columnsep}{1cm} % sets the column divider space in between columns
\date{} % Removes the date
\hyphenpenalty=10000
\hfuzz=5pt % The \hfuzz setting specifies the maximum amount of box-overflow before a warning message will be issued.
\pagenumbering{gobble}%gets rid of page numbers
\title{\vspace{-1cm}\Huge Curriculum Vitae}
\author{\Large\textbf{name}\\email\\number}

\begin{document}

\begin{tabularx}{\linewidth}{@{}p{0.18\linewidth}!{\color{RawSienna}\vrule width 0.3mm}X@{}}
\raggedright \textbf{insert profession here} \newline \footnotesize{dates} 
& \begin{itemize}[leftmargin=5mm, itemsep=1mm, after = \vskip-\baselineskip]
\item BLA
\item BLA 2
\item BLA 3
\end{itemize}\\
\end{tabularx}

\end{document}

答案1

以下是itemize中的的仿制实现tabular,称为tabularitemize。它重新定义\item为插入一个制表符换行符 ( \\),后跟 和\textbullet列跳过&- 仿制列表的第一列为\textbullet,第二行p是项目内容的段落列。

在此处输入图片描述

\documentclass{article}

\usepackage[margin=1in]{geometry}

\usepackage{array}
\usepackage{tabularx} % allows for tables to be created by coloumn spacing instead of line spacing as in tabular
\usepackage[dvipsnames]{xcolor} % imports the a colour pallet for things like lines
\usepackage{colortbl} % allows colour formatting for table lines

\usepackage{environ}
\makeatletter
\NewEnviron{tabularitemize}{%
  \global\let\olditem\item
  \def\item{\gdef\item{\\ \textbullet&}\textbullet&}%
  \begin{tabular}[t]{@{}wr{1em}@{\hspace{\tabcolsep}}p{\dimexpr\linewidth-1em-\tabcolsep}@{}}
    \BODY
  \end{tabular}
  \global\let\item\olditem
}

\begin{document}

\begin{tabularx}{\linewidth}{@{}p{0.18\linewidth}!{\color{RawSienna}\vrule width 0.3mm}X@{}}
  \raggedright \textbf{insert profession here} \newline \footnotesize{dates} 
  & \begin{tabularitemize}
    \item Blah 1 The quick brown fox jumps over the lazy dog. 
      The quick brown fox jumps over the lazy dog. 
      The quick brown fox jumps over the lazy dog.
    \item Blah 2 The quick brown fox jumps over the lazy dog. 
      The quick brown fox jumps over the lazy dog.
    \item Blah 3
  \end{tabularitemize}
\end{tabularx}

\end{document}

\textbullet列的1em宽度(和r右对齐)与\tabcolsep项目符号和项目内容之间的距离相同。

答案2

compress只需在列前插入X

begin{tabularx}{\linewidth}{@{}p{0.18\linewidth}!{\color{RawSienna}\vrule width 0.3mm}
                             >{\compress}X@{}}

结果将变成如下形式:

在此处输入图片描述

完成 MWE:

\documentclass[a4paper]{article}

\usepackage{array}
\makeatletter
\newcommand{\compress}{\@minipagetrue}
\makeatother

\usepackage[a4paper,bindingoffset=0.2in,%
            margin=2cm,%
            footskip=.25in]{geometry}
\usepackage{multicol}
\usepackage{enumitem} % for formatting itemized lists
\usepackage{parskip}
\usepackage{tabularx} % allows for tables to be created by coloumn spacing instead of line spacing as in tabular
\usepackage[table, dvipsnames]{xcolor}%imports the a colour pallet for things like lines

\setlength{\columnsep}{1cm} % sets the column divider space in between columns
\date{} % Removes the date
\hyphenpenalty=10000
\hfuzz=5pt % The \hfuzz setting specifies the maximum amount of box-overflow before a warning message will be issued.
\pagenumbering{gobble}%gets rid of page numbers
\title{\vspace{-1cm}\Huge Curriculum Vitae}
\author{\Large\textbf{name}\\email\\phone}

\begin{document}

\begin{tabularx}{\linewidth}{@{}p{0.18\linewidth}!{\color{RawSienna}\vrule width 0.3mm}
                             >{\compress}X@{}}
\raggedright \textbf{insert profession here} \newline \footnotesize{dates}
& \begin{itemize}[leftmargin=5mm, itemsep=1mm, 
                  after = \vskip-\baselineskip]
\item BLA
\item BLA 2
\item BLA 3
\end{itemize}\\
\end{tabularx}

\end{document}

相关内容