删除列表项前的项目符号和前导空格

删除列表项前的项目符号和前导空格

我有一些嵌套列表需要格式化。我想从外部列表中删除项目符号和前导空格,同时保持内部列表不变。

以下是一些示例代码:

\documentclass[10pt]{article}
\usepackage{enumitem}

\begin{document}

\section{Section Title}
\subsection{Subsection Titlte}

\begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
    %
    \item List item with bullet that I want gone
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
    \item List item with bullet that I want gone
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
\end{itemize}
\end{document}

下面的图片上半部分显示了上述代码的输出。图片的下半部分显示了我希望的输出。我添加了红色和蓝色垂直线来帮助说明所需的间距。请注意,所需的输出会从外部列表中删除项目符号和前导空格。它将外部列表的文本与已删除项目符号的左侧对齐。内部列表保持完全不变。

我尝试使用enumitem来设置 、 和 的值leftmarginlabelindent但是labelsep,我不知道如何实现所需的输出。任何提示都将不胜感激。

上面是我拥有的,下面是我想要的

答案1

这是一个解决方案:

\documentclass[10pt]{article}
\usepackage{enumitem}
\newlist{balditemize}{itemize}{1}
\setlist[balditemize]{label=, wide=\parindent, labelsep*=0pt, leftmargin=*, topsep=0pt, itemsep=0pt}
\usepackage[showframe]{geometry}

\begin{document}

\section{Section Title}
\subsection{Subsection Title}

\begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
    %
    \item List item with bullet that I want gone
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
    \item List item with bullet that I want gone
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
\end{itemize}

\section{Section Title}
\subsection{Subsection Title}

\begin{balditemize}
   \setlist[itemize, 1]{wide=\dimexpr\leftmargini-\fontdimen2\font, leftmargin=*, labelsep =5pt, topsep=0pt, itemsep=0pt}%
    \item List item with bullet that I want gone List item with bullet that I want gone List item with bullet that I want gone List item with bullet that I want gone
        \begin{itemize}
            \item Inner list item (I want to keep these bullets) Inner list item (I want to keep these bullets) Inner list item (I want to keep these bullets) Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}

    \item List item with bullet that I want gone
        \begin{itemize}
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
\end{balditemize}

\end{document} 

在此处输入图片描述

答案2

您可能需要一种更自动化的方法,但这里有一个临时解决方案:

您可以\item[]结合使用 leftmargin。通过检查值,默认 leftmargin 似乎是25pt,宽度\bullet似乎是5pt,项目符号和文本之间的间距也是5pt。因此新的 leftmargin 应该是25pt - 10pt=15pt。此外,我们必须添加5pt“内部”左边距(5pt+25pt=30pt)以弥补项目符号和项目之间的距离:它实际上按预期工作:

\documentclass[10pt]{article}
\usepackage{enumitem}
\begin{document}

\section{Section Title}
\subsection{Subsection Title}
\begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
    %
    \item List item with bullet that I want gone (below)
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
    \item List item with bullet that I want gone (below)
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
\end{itemize}

\begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt, leftmargin=15pt]
    %
    \item[] List item with bullet that I want gone
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt, leftmargin=30pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
    \item[] List item with bullet that I want gone
        \begin{itemize}[label={$\bullet$}, topsep=0pt, itemsep=0pt, leftmargin=30pt]
            \item Inner list item (I want to keep these bullets)
            \item Inner list item (I want to keep these bullets)
        \end{itemize}
    %
\end{itemize}
\end{document}

输出

在此处输入图片描述

相关内容