如何防止描述中出现换行?

如何防止描述中出现换行?

基本问题,但我只是想知道如何在使用时防止换行description。我对乳胶很陌生,所以不确定它是如何工作的。我有的代码在这里。

\begin{description}  
\item[Lane 1]NEB 1kb Ladder  
\item[Lane 2](Single Digest) pET-41a/EGFP Recombinant plasmid  
\item[Lane 3](Double Digest) pET-41a/EGFP Recombinant plasmid  
\item[Lane 4](Undigested) pET-41a/EGFP Recombinant plasmid 

我很抱歉,为了澄清我所说的换行是什么意思,我的意思是我想防止列表中每个项目之间出现间距。

答案1

看一下enumitem包装。手册会告诉您如何正确设置间距。我怀疑这与标签尺寸有关。

\documentclass{article}


\usepackage[inline]{enumitem}

\begin{document}

\begin{description*} \item[Lane 1]NEB 1kb Ladder; \item[Lane 2](Single Digest) pET-41a/EGFP Recombinant plasmid; \item[Lane 3](Double Digest) pET-41a/EGFP Recombinant plasmid; \item[Lane 4] (Undigested) pET-41a/EGFP Recombinant plasmid.  
\end{description*}
\end{document}

答案2

description*(JPI 答案)的内联enumitem很丑陋,因为标签后的巨大空间和项目缺少连字符在这种模式下没有什么意义:

糟糕的解决方案

在这种情况下,更好的是paralist

MWE4

\documentclass{article}
\usepackage[alwaysadjust]{paralist}
\begin{document}
\begin{inparadesc}
\item[Lane 1.] NEB 1kb Ladder,
\item[Lane 2.] (Single Digest) pET-41a/EGFP Recombinant plasmid, 
\item[Lane 3.] (Double Digest) pET-41a/EGFP Recombinant plasmid and
\item[Lane 4.] (Undigested) pET-41a/EGFP Recombinant plasmid.  
\end{inparadesc}
\end{document}

但是,在这种情况下,由于标签有计数器,最好返回enumitem并使用enumerate*,,此外,控制项目之间的内容,并自动在最后两个项目之间包含“和”。我把自动包含的所有内容都保留为红色(当然,为了实际工作,请删除颜色):

mwe2

或者如果您希望手动结束项目标点符号,或者不包含任何标点符号,那么另一个选项是定义您自己的环境(使用 paralist 的上述输出相同)而不使用 enumitem,o 可能意图与某些垂直分隔相同:

MWE3

\documentclass{article}
\usepackage{xcolor}
\parskip 1em
\usepackage[inline]{enumitem}
\newcounter{descinline}

\def\ditem{\addtocounter{descinline}{1}\textbf{Lane \arabic{descinline}}.~}
\begin{document}

\begin{description*}[leftmargin=*,labelsep=*]
\item[Lanes 1]NEB 1kb Ladder; 
\item[Lane 2](Single Digest) pET-41a/EGFP Recombinant plasmid; 
\item[Lane 3](Double Digest) pET-41a/EGFP Recombinant plasmid; 
\item[Lane 4] (Undigested) pET-41a/EGFP Recombinant plasmid.  
\end{description*}

\begin{enumerate*}[label={\textcolor{red}{\bfseries
Lane\,\arabic*:}}, itemjoin={\textcolor{red}{, }} ,
itemjoin*={\textcolor{red}{ ,\ and\ }}]
\item NEB 1kb Ladder
\item (Single Digest) pET-41a/EGFP Recombinant plasmid
\item (Double Digest) pET-41a/EGFP Recombinant plasmid
\item (Undigested) pET-41a/EGFP Recombinant plasmid.  
\end{enumerate*}

\newenvironment{descinline}{\setcounter{descinline}{0}}{}   
\begin{descinline}%
\ditem NEB 1kb Ladder.  
\ditem (Single Digest) pET-41a/EGFP Recombinant plasmid,   
\ditem (Double Digest) pET-41a/EGFP Recombinant plasmid and   
\ditem (Undigested) pET-41a/EGFP Recombinant plasmid.
\end{descinline}

\renewenvironment{descinline}{\setcounter{descinline}{0}
\list{}{\setlength{\leftmargin}{4em}}\item[]\relax}{\endlist}   
\begin{descinline}%
\ditem NEB 1kb Ladder,  
\ditem (Single Digest) pET-41a/EGFP Recombinant plasmid,   
\ditem (Double Digest) pET-41a/EGFP Recombinant plasmid and  
\ditem (Undigested) pET-41a/EGFP Recombinant plasmid.
\end{descinline}

\end{document}

或者,为什么要重新发明轮子?还有inparaenum(输出与相同inparadesc,但现在标签是自动输入的)

\documentclass{article}
\usepackage[alwaysadjust]{paralist}
\begin{document}
\begin{inparaenum}[\bfseries {Lane}~1.]
\item NEB 1kb Ladder,
\item (Single Digest) pET-41a/EGFP Recombinant plasmid, 
\item (Double Digest) pET-41a/EGFP Recombinant plasmid and
\item (Undigested) pET-41a/EGFP Recombinant plasmid.  
\end{inparaenum}
\end{document}

相关内容