2

I would like to receive some help for writing a block o text completely on the right, in the form as in the photo below. Thank you so much! enter image description here

2
  • Should "Bla bla bla..." be breakable across the page boundary?
    – Werner
    Feb 16, 2021 at 20:19
  • @Werner Yes, it shall be a long text which should be breakable in many lines!
    – Henry
    Feb 16, 2021 at 20:23

5 Answers 5

3
\documentclass{article}
\usepackage{tabularx}
\begin{document}

\begin{tabularx}{\linewidth}{lX}
Some text here:&
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Donec
  hendrerit tempor tellus.  Donec pretium posuere tellus.  Proin quam
  nisl, tincidunt et, mattis eget, convallis nec, purus.  Cum sociis
  natoque penatibus et magnis dis parturient montes, nascetur
  ridiculus mus.  Nulla posuere. \\ \vspace{2ex}

Some other text here :&
    Pellentesque dapibus suscipit ligula.  Donec posuere augue in
    quam.  Etiam vel tortor sodales tellus ultricies commodo.
    Suspendisse potenti.  Aenean in sem ac leo mollis blandit.  Donec
    neque quam, dignissim in, mollis nec, sagittis eu, wisi.
    Phasellus lacus. 
  \end{tabularx}

  \begin{tabularx}{\linewidth}{lX}
Some text:&
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Donec
  hendrerit tempor tellus.  Donec pretium posuere tellus.  Proin quam
  nisl, tincidunt et, mattis eget, convallis nec, purus.  Cum sociis
  natoque penatibus et magnis dis parturient montes, nascetur
  ridiculus mus.  Nulla posuere.  Donec vitae dolor.  Nullam tristique
  diam non turpis.  Cras placerat accumsan nulla.  Nullam rutrum.  Nam
  vestibulum accumsan nisl.\vspace{2ex}
  \end{tabularx}

\end{document}

Texte

4
  • Simple and effective!
    – Henry
    Feb 16, 2021 at 21:15
  • 1
    @Henry: Note that this won't break the text across the page boundary, as requested.
    – Werner
    Feb 16, 2021 at 21:23
  • @Werner: One can use xltabular instead of tabularx.
    – gigiair
    Feb 19, 2021 at 9:40
  • @gigiair: You will still have trouble to break mid-paragraph. It would be good if you could show an xltabular approach.
    – Werner
    Feb 19, 2021 at 20:45
6

You can use \hagindent and \hangafter TeX primitives after the text is measured using \setbox primitive:

\def\p #1: {\par \setbox0=\hbox{#1: }\hangafter=1\hangindent=\wd0 \noindent\box0 }

\p Sometext here: 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 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.
2
  • How to stop the command then?
    – Henry
    Feb 16, 2021 at 20:59
  • 2
    The settings is valid only for one paragraph. Next paragraph is printed normally.
    – wipet
    Feb 16, 2021 at 21:11
3

The following approach uses paracol to set a two-column environment with the left column containing only the heading.

enter image description here

\documentclass{article}

\usepackage{paracol,lipsum}

\newlength{\sometextheading}
\newenvironment{sometext}[1]{%
  \settowidth{\sometextheading}{#1:}%
  \setcolumnwidth{\sometextheading}%
  \par
  \begin{paracol}{2}
    \noindent #1:
    \switchcolumn[1]\noindent\ignorespaces
}{%
  \end{paracol}
}

\begin{document}

\sloppy% Just for this example
Here is some text

\begin{sometext}{Some text}
  \lipsum[1]
\end{sometext}

\begin{sometext}{Some more text here}
  \lipsum[2]
\end{sometext}

\begin{sometext}{Yet more text}
  \lipsum[3-6]
\end{sometext}

\begin{sometext}{Some closing text}
  \lipsum[7]
\end{sometext}

\end{document}
3

You can do that with a description environment, customised with enumitem. The interesting point is that the contents of an item can break across pages.

\documentclass{book}
\usepackage{enumitem}
\usepackage{calc} 

\begin{document}

\begin{description}[font=\normalfont, leftmargin=\widthof {Some text here: } + \labelsep]
  \item[Some text here: ] Blah blah blah blah …… blah blah blah blah blah blah blah blah. 
  Blah blah blah blah …… blah.
\end{description}
\begin{description}[font=\normalfont, leftmargin=\widthof {Some other text here: }+\labelsep]
  \item[Some other text here: ] Blah blah blah blah …… blah blah blah blah blah blah blah blah. 
  Blah blah blah blah …… blah.
\end{description}

\end{document} 

enter image description here

0

Here's a very simple solution: use itemize with your left hand text as your custom 'bullet symbol'. This doesn't require any packages, or much code, and it makes all right hand text aligned.

\documentclass{article}
\begin{document}

\begin{itemize}
 \item[Some text here:] Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Donec hendrerit tempor tellus.  Donec pretium posuere tellus.  Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.  Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.  Nulla posuere. \\ \vspace{2ex}
 \item[Some other text here:] Pellentesque dapibus suscipit ligula.  Donec posuere augue in quam.  Etiam vel tortor sodales tellus ultricies commodo. Suspendisse potenti.  Aenean in sem ac leo mollis blandit.  Donec neque quam, dignissim in, mollis nec, sagittis eu, wisi.  Phasellus lacus. 
\end{itemize}
 
\end{document}

output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .