Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need to number the sentences in a text in a way that makes it clear that the numbers are not part of the text. The best I've been able to come up with looks pretty horrible:

enter image description here

I'd be grateful for anything more attractive!

FWIW, The code that generated that is here:

\documentclass{article} 
\usepackage{calc}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usepackage{environ,varwidth}

\mdfdefinestyle{tight}{roundcorner=1.5pt,innerleftmargin=0.7pt,innerrightmargin=0.7pt,innertopmargin=1pt,innerbottommargin=1pt,backgroundcolor=gray!20}

\newsavebox\MyTempBox
\NewEnviron{tight}{%
\savebox\MyTempBox{%
\begin{varwidth}{\linewidth}
\BODY
\end{varwidth}}%
\begin{minipage}{\dimexpr\wd\MyTempBox+2.5pt\relax}
\begin{mdframed}[style=tight,userdefinedwidth=\dimexpr\wd\MyTempBox+2.5pt\relax]
\BODY
\end{mdframed}%
\end{minipage}
}%

\newcommand\sno[1]{\begin{tight}\scriptsize\bf #1\end{tight}}

\begin{document}    
\sno{21}Lorem Ipsum is simply dummy text of the printing and typesetting industry. \sno{22}Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \sno{23}It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. \sno{24}It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{document}

One minor point worth noting is that having a line break immediately after the number (like 24 in my example above) is not great.

share|improve this question
add comment

3 Answers

Simplify, using smaller numbers and lowering them:

enter image description here

Minimal,

\documentclass{article} 
\newcommand\sno[1]{$_{#1}$}
\begin{document}    
\sno{21}Lorem Ipsum is simply dummy text of the printing and typesetting industry.  \sno{22}Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \sno{23}It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. \sno{24}It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{document}

You can also automate the counting using a counter,

\documentclass{article} 
\newcounter{sno}
\setcounter{sno}{21}
\newcommand\sno{\stepcounter{sno}$_{\thesno}$}
\begin{document}    
\sno Lorem Ipsum is simply dummy text of the printing and typesetting industry. \sno Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \sno It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. \sno It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
\end{document}
share|improve this answer
add comment

It even is possible to get an automated enumeration of sentences. Markus Kohm, author and maintainer of the KOMAscript bundle, implemented this in a package called scrjura, but the manual never was translated to english, because it is focused on the needs of Lawyers in Germany.

But maybe you are interested in something like this:

\documentclass[pagesize, english]{scrartcl}
\usepackage{babel, scrjura, xcolor, etoolbox}

\useshorthands{/}
\defineshorthand{/S}{\Sentence\ignorespaces}
\defineshorthand{/.}{. \Sentence\ignorespaces}

\makeatletter
\preto\contract@paragraph@font{\color{white}}
\makeatother



\begin{document}


\begin{contract}
\Paragraph{}
  /S Lorem Ipsum is simply dummy text of the printing and typesetting
  industry/. Lorem Ipsum has been the industry's standard dummy text
  ever since the 1500s, when an unknown printer took a galley of type
  and scrambled it to make a type specimen book/. It has survived not
  only five centuries, but also the leap into electronic typesetting,
  remaining essentially unchanged/. It was popularised in the 1960s
  with the release of Letraset sheets containing Lorem Ipsum passages,
  and more recently with desktop publishing software like Aldus
  PageMaker including versions of Lorem Ipsum.
\end{contract}


\end{document}

You see, enumerated sentences:

enter image description here

share|improve this answer
add comment

Inspired by Yiannis's less obstrusive solution, I tried using an interlinear gloss.

enter image description here

It didn't work all that well due to lack of interlinear space, but for what it's worth, here is the code:

\documentclass{article} 
\usepackage{fontspec}
\newcommand\sno[1]{\makebox[0pt]{{\setmainfont{LinotypeZapfino Two}\smash{\raisebox{-2.7pt}{\small #1}}}}}
\begin{document}    
\sno{21}Lorem Ipsum is simply dummy text of the printing and typesetting industry.  \sno{22}Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \sno{23}It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. \sno{24}It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.