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