行距帮助,expl3

行距帮助,expl3

我有一个宏makeentry,我无法让它按预期运行。它非常简单,它获取先前输入的用户数据并对其进行格式化。但是,我无法让宏正确地尊重我的愿望parskipsvspaces发生了一些非常奇怪的交互,我肯定忽略了。不仅没有parskip发生,而且vspace位置也不对!

在本 mwe 中,我提供了两列比较,左边是宏格式的文本,右边是手动格式(和预期输出)的文本。

在此处输入图片描述

\documentclass{book}

\usepackage{xparse}
\usepackage[usenames,dvipsnames,table]{xcolor}%allows more color options. 

\ExplSyntaxOn
%*******************************************tokenlists***************************************************%
\tl_new:N \itemname_mwe%used to store the name
\tl_new:N \itemdescr_mwe%used to store the description
\tl_new:N \itemnote_mwe%used to store a note

%********************************Global_variable_storage_commands****************************************%
\NewDocumentCommand{\name}{s+m} {%set command for names
    \tl_set:Nn \itemname_mwe {#2}
}

\NewDocumentCommand{\descr}{s+m} {%set command for descriptions
    \tl_set:Nn \itemdescr_mwe {#2}
}
\NewDocumentCommand{\note}{s+m} {%set command for notes
    \tl_set:Nn \itemnote_mwe {#2}
}

\NewDocumentCommand{\makeentry}{}{
    \tl_if_empty:NF \itemname_mwe {%
        {\color{black}\sffamily\bfseries \tl_use:N \itemname_mwe}\\
    }
    \tl_if_empty:NF \itemdescr_mwe {%
        \textit{\tl_use:N \itemdescr_mwe}\\ 
    }
    \tl_if_empty:NF \itemnote_mwe {%
        \vspace{15pt plus 2.0pt}
        \tl_use:N \itemnote_mwe\\
    }
}

\ExplSyntaxOff

\begin{document}

\twocolumn
\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt plus 2.0pt}



\name{Mount Baker}
\descr{Mount Baker, also known as Koma Kulshan or simply Kulshan, is a 10,781 ft active glacier-covered andesitic stratovolcano in the Cascade Volcanic Arc and the North Cascades of Washington in the United States. Mount Baker has the second-most thermally active crater in the Cascade Range after Mount St. Helens.}

\note{Mount Baker was well known to indigenous peoples of the Pacific Northwest. Indigenous names for the mountain include Koma Kulshan or Kulshan. In 1790, Manuel Quimper of the Spanish Navy set sail from Nootka, a temporary settlement on Vancouver Island, with orders to explore the newly discovered Strait of Juan de Fuca.}

\makeentry

\vfill\break

{\color{black}\sffamily\bfseries Mount Baker}\\
{\itshape Mount Baker, also known as Koma Kulshan or simply Kulshan, is a 10,781 ft active glacier-covered andesitic stratovolcano in the Cascade Volcanic Arc and the North Cascades of Washington in the United States. Mount Baker has the second-most thermally active crater in the Cascade Range after Mount St. Helens.}

\vspace{15pt plus 2.0pt}

{\upshape Mount Baker was well known to indigenous peoples of the Pacific Northwest. Indigenous names for the mountain include Koma Kulshan or Kulshan. In 1790, Manuel Quimper of the Spanish Navy set sail from Nootka, a temporary settlement on Vancouver Island, with orders to explore the newly discovered Strait of Juan de Fuca.}

\end{document}

相关内容