边缘处带有标签的描述

边缘处带有标签的描述

我正在开发一个“书籍”类,这意味着奇数页的页边距在右侧,偶数页的页边距在左侧。我的目标是编写一个描述列表,其中标签自动放在页边距中,而项目本身的描述则放在正文中。到目前为止,我尝试了许多不同的方法,但都没有成功。这是我能得到的最好的方法,仅适用于左边距的页面:

\documentclass[symmetric,justified,marginals=raggedright]{book} 
    \usepackage{enumitem}
\begin{document}
This is the first page with a margin on the right: my code does not work!
\setlist[description]{font=\normalfont}
\begin{description} [align=right]
    \item [\protect{\parbox[t]{4.3cm}{\textbf{Concept}}}]
        \textbf{Description}
    \item [\protect{\parbox[t]{4.3cm}{This is the first item I want to describe}}]
        \protect{\parbox[t]{10cm}{This is the description of the first item.}}
    \item [\protect{\parbox[t]{4.3cm}{This is the second item I want to describe}}]
        \protect{\parbox[t]{10cm}{This is the description of the second item, which is normally longer than only one line.}}
\end{description}
This is the normal text bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.
\newpage    
This is the second page where my code is giving an acceptable result.
\setlist[description]{font=\normalfont}
\begin{description} [align=right]
    \item [\protect{\parbox[t]{4.3cm}{\textbf{Concept}}}]
        \textbf{Description}
    \item [\protect{\parbox[t]{4.3cm}{This is the first item I want to describe}}]
        \protect{\parbox[t]{10cm}{This is the description of the first item.}}
    \item [\protect{\parbox[t]{4.3cm}{This is the second item I want to describe}}]
        \protect{\parbox[t]{10cm}{This is the description of the second item, which is normally longer than only one line.}}
\end{description}

\end{document}

这是相应的输出:

在此处输入图片描述

有人能帮帮我吗?提前谢谢您!

答案1

这是一个可能的解决方案。我定义了一个margindescription描述的克隆,带有特定的参数,以及一个\mitem可以完成所有你想要的命令,我想:

\documentclass[11pt, twosided]{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage[showframe, twoside, marginpar=3cm, outer = 36mm]{geometry}
\usepackage[fulladjust]{marginnote}
\newcommand\mitem[1][]{\item[\vphantom{\parbox{3cm}{#1\vspace*{\itemsep}}}]\marginnote{#1}}
\newlist{margindescription}{description}{1}

\setlist[margindescription]{labelsep=0pt, font=\normalfont,after =\vspace*{\dimexpr\topsep + \partopsep + \itemsep\relax}}

\begin{document}

\begin{margindescription}% [labelsep=0pt, font=\normalfont,after =\vspace*{\dimexpr\topsep + \partopsep + \itemsep\relax}]%after ={\item[]}
  \mitem[\bfseries Concept]
  \textbf{Description}
  \mitem [This is the first item I want to describe]
This is the description of the first item.
  \mitem [This is the second item I want to describe]
  This is the description of the second item, which is normally longer than only one line.
\end{margindescription}
This is the normal text bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla

\begin{description} [font=\normalfont]%
  \item[\bfseries Concept]
  \textbf{Description}
  \item [This is the first item I want to describe]
This is the description of the first item.
  \item [This is the second item I want to describe]
  This is the description of the second item, which is normally longer than only one line.
\end{description}
This is normal text bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. \newpage
\begin{description} [labelsep=0pt, font=\normalfont]%
  \mitem[\bfseries Concept]
  \textbf{Description}
  \mitem [This is the first item I want to describe]
  This is the description of the first item.
  \mitem [This is the second item I want to describe]
 This is the description of the second item, which is normally longer than only one line.
\end{description}
This is normal text bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. 
\end{document} 

得到两页:

在此处输入图片描述

在此处输入图片描述

相关内容