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.

desired text spacing

Hi, I wanted to create column of text after bolded "Lorem Ipsum 1.", which has no specified linebreaks. This space before text (marked on image with red line and question marks) should have exact width of "Lorem Ipsum 1." How can I do it in LaTeX?

share|improve this question
    
Do you need page breaking of this block, or will it always appear on a single page? –  Steven B. Segletes May 18 at 17:00
    
Can't guarantee it will always appear on a single page. Page breaking would be welcomed. –  Mike May 18 at 17:09

2 Answers 2

up vote 5 down vote accepted

You could use enumitem's description list:

enter image description here

Notes:

  • This properly handles the text going across page boundaries.
  • If you don't want a blank line between the two, simply add the nosep option as in \begin{description}[leftmargin=!, labelwidth=\widthof{\bfseries #1},nosep].
  • The showframe package was used just to show the page margins. It is not needed in your actual use case.
  • The lipsum package was used just to provide dummy text. It is also not needed in your document.

Code:

\documentclass{article}
\usepackage{showframe}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{lipsum}

\newcommand{\MyEntry}[2][]{%
    % #1 = label
    % #2 = content
    \begin{description}[leftmargin=!, labelwidth=\widthof{\bfseries #1}]
        \item [#1] #2
    \end{description}
}%


\begin{document}
\MyEntry[Lorem Ipsum1.]{\lipsum[1]}

\MyEntry[Phasellus elementum 2.]{\lipsum[2]}
\end{document}
share|improve this answer
    
Would it be possible not to create newline after description? –  Mike May 18 at 21:40
1  
@Mike: Yep, use nosep option. Have added a comment in the solution. –  Peter Grill May 18 at 22:12

A variant, also using the description environment and enumitem. I define a sommaire environment (from the french term that describes that type of typographical composition — I don't know how to translate it in English). This environment takes a mandatory argument, which is the “title”, and an optional argument, which is the value of \parindent inside the environment (default is 0em). I don't know how to hand the current font on to the environment, so as to use it for the title font (description defaults to roman boldface), hence I had to code the font family in the environment code.

I give an example with several paragraphs and indentation:

\documentclass{article}
\usepackage[utf8]{inputenc} 

\usepackage{enumitem}
\usepackage{lipsum}
\usepackage[showframe, nomarginpar]{geometry}

\newenvironment{sommaire}[2][itemindent=1em]{
\newlength\mymarginwd\settowidth{\mymarginwd}{\bfseries#2\enspace} \setlength\listparindent{1em} \begin{description}[style=sameline, labelindent=0pt, #1, leftmargin=\mymarginwd, font = \sffamily]%
\item[#2]\setlength\parindent{\itemindent}
}%
{\end{description}}

\begin{document}

\sffamily
\vspace*{0.7\textwidth}
\begin{sommaire}{Lorem Ipsum 1.}
\lipsum[1-4]
\end{sommaire}

\end{document} 

enter image description here

share|improve this answer

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.