1

In the attached code I would like to include the spacing above and below in the definition of the new command, without using hspace. Is this possible?

    \documentclass[a4paper,11pt,draft]{report}
    \usepackage[utf8]{inputenc}
    
    \newcommand\Tom {\noindent\hbox to35mm{Tom\hfil}\hangindent=35mm \hangafter=1 }
    \newcommand\Mary {\noindent\hbox to35mm{Mary\hfil}\hangindent=35mm \hangafter=1 }
    
    \begin{document}
    
    \Tom
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    
    \hspace{10mm}
    
    \Mary
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    
    \end{document}
2
  • why are you using low level tex primitives here rather than a latex list? Dec 11, 2020 at 19:29
  • I would like to build a play script template using the standard Latex commands.
    – Andy Toff
    Dec 15, 2020 at 7:42

1 Answer 1

1

Funny: \hspace actually introduces horizontal space. Because of its definition and of the behaviour of the TeX primitive \hskip in vertical mode it looks like it's introducing vertical space.

Add the vertical space in your macros. Note that \hangafter=1 wasn't actually doing anything.

\documentclass[a4paper,11pt,draft]{report}
\usepackage[utf8]{inputenc}

\newcommand\Tom{\par\bigskip\noindent\hbox to35mm{Tom\hfil}\hangindent=35mm }
\newcommand\Mary{\par\bigskip\noindent\hbox to35mm{Mary\hfil}\hangindent=35mm }
    
\begin{document}

\Tom
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
is simply dummy text of the printing and typesetting industry. Lorem Ipsum is
simply dummy text of the printing and typesetting industry.

\Mary
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum is simply dummy text of the printing and typesetting industry.
    
\end{document}

enter image description here

1
  • I confused horizontal with vertical. Sorry.
    – Andy Toff
    Dec 15, 2020 at 7:45

You must log in to answer this question.

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