使用 easylist 方便地格式化描述环境

使用 easylist 方便地格式化描述环境

当我写笔记时,我喜欢把它们设置成一种字典,粗体术语,后面跟着定义/描述。我很高兴遇到了这个description环境,并开始使用它(见下面的代码块)。

现在,我真正想知道的是,是否有人有任何技巧或想法可以加快我写笔记的过程,因为它们很长,所以我不想\item [ ]每次定义新术语时都打字。我想到了一些想法:

  • 我发现easylist它非常方便;但是我不知道如何(如果)我可以将其格式化为看起来像环境description(特别是,我找不到单独更改项目名称的方法,这对我来说非常重要!)

  • 另一种方法可能是配置一些键盘快捷键,尽管我不确定最好的方法(我使用 TeXmaker 和 Overleaf)。

下面是一个使用示例description(其中包括我遇到的一些问题,尽管我不希望受到这些问题的影响,因此我并不太关心解决这些问题):

\documentclass[twocolumn]{article}
\usepackage{enumitem}
\begin{document}
\begin{description}[align=left,leftmargin=1cm]
\item [Item one] Followed by text description. This description has been made longer to demonstrate the hang feature when text flows over to the next line.
\item [2.] Notice that indent is not maintained for the first line of an item with a short name. I do not mind this too much though.
\item [This is a really long item name which extends beyond the column border] I understand that this could be dealt with using multiline, but I don't really like the way that looks:
 \begin{description}[align=left,style=multiline,leftmargin=1cm]
  \item [This list] is a demonstration of how one might try to use
  \item [multiline] for long item names. There are some
  \item [problems] with this, as you can see.
 \end{description}
\item [Item four] Returning to the main list. The sublist above works fine. Another example of a sublist follows:
 \begin{itemize}
  \item this is an itemize list
  \item embedded within a description list and this actually works well and I am really happy with how this looks!
 \end{itemize}
\item [Item five] Again returning to the main list.
\end{description}
\end{document}

输出如下:

输出

答案1

你想做的事情和我使用的方式非常相似易清单在会议上做笔记。对我的代码进行一些修改后,我得到了一些接近你想要的东西。

我用:

  • #对于每个项目标题
  • ##对于每个项目的文本,将其放在新行上
  • ###对于每个后续列表项

#因此,粗略地说,我为每个缩进级别添加另一个。

我只将第一级项目标题视为“特殊”。当然,您可以对后续项目标题做同样的事情。对于我的笔记,我有一个类似的问题,我通过将感叹号变成活动字符然后使用它!{stuff}来突出显示“东西”来解决。我也在下面做了这个。

我更喜欢使用颜色而不是粗体,但如果你喜欢这种方法,那么这是一个很容易改变的细节。我还使用\blacktriangleright\bullet标记子列表。使用我的代码,您的 MWE 会产生:

在此处输入图片描述

...这是乳胶代码:

\documentclass[twocolumn,a5paper,landscape]{article}

\usepackage[x11names]{xcolor}
\usepackage[sharp]{easylist}
\usepackage{amsmath,amssymb}

\catcode`\!=13
\newcommand![1]{\textcolor{red}{#1}}

\ListProperties(
    Hang=true,
    Hide2=2,
    Hide3=3,
    Hide4=4,
    Hide5=5,
    Indent2=0em,
    Indent3=1em,
    Indent4=0em,
    Indent5=0.5em,
    Numbers1=a,
    Space1=1em,
    Space3=0em,
    Style1=\color{blue}\bfseries,
    Style3*=$\color{DodgerBlue2}\blacktriangleright$\space,
    Style4*=$\color{DodgerBlue3}\bullet$\space,
    Style5*=$\color{DodgerBlue3}-$\space,
)

\begin{document}

\begin{easylist}
  # Item one
  ## Followed by text description. This description has been made longer to demonstrate the hang feature when text flows over to the next line.
  # 2.
  ## Notice that indent is not maintained for the first line of an item with a short name. I do not mind this too much though.
  # This is a really long item name which extends beyond the column border
  I understand that this could be dealt with using multiline, but I
  don't really like the way that looks:
  ### !{This list}is a demonstration of how one might try to use
  ### !{multiline} for long item names. There are some
  ### !{problems} with this, as you can see.
  # Item four
  ## Returning to the main list. The sublist above works fine. Another example of a sublist follows:
  ### this is an itemize list
  ### embedded within a description list and this actually works well and I am really happy with how this looks
  # Item five
  ##Again returning to the main list.
\end{easylist}

\end{document}

实际上,我将其中大部分内容隐藏在类文件中,这样我在打字时只需要担心实际的“列表”。

相关内容