1

I want to create multiple dotted lines, I found this code on the internet

\newcommand{\Pointilles}[1][3]{%
        \multido{}{#1}{\makebox[\linewidth]{\dotfill}\\[\parskip]}
        }

The problem is that the first dotted line comes too close to last one in the paragraph and adding some vertical space manually as shown below

some text her. \\[4mm]
\Pointilles[2]

may cause the vertical space to appear after the dotted lines. At the same time I would like to be able to specify the line spacing for the dotted lines.

  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jun 3 '15 at 20:48
  • Does tex.stackexchange.com/questions/241137/… help? – cfr Jun 3 '15 at 23:04
3

There are a number of ways of achieving your goal. The following merely builds on what you've already created:

enter image description here

\documentclass{article}
\usepackage{multido}

\newcommand{\Pointilles}[1]{%
  \par\nobreak
  \noindent\rule{0pt}{1.5\baselineskip}% Provides a larger gap between the preceding paragraph and the dots
  \multido{}{#1}{\noindent\makebox[\linewidth]{\dotfill}\endgraf}% ... dotted lines ...
  \bigskip% Gap between dots and next paragraph
}
\begin{document}

Here is some text.
\Pointilles{5}

Here is some more text.
\Pointilles{3}

Here is some final text.
\Pointilles{2}

\end{document}

A minor adjustment to \Pointilles could allow you to stretch the content using an adjustable \strut:

enter image description here

\documentclass{article}
\usepackage{multido}

\newcommand{\Pointilles}[2][3]{%
  \par\nobreak
  \noindent\rule{0pt}{1.5\baselineskip}% Provides a larger gap between the preceding paragraph and the dots
  \multido{}{#2}{\noindent\makebox[\linewidth]{\rule{0pt}{#1\baselineskip}\dotfill}\endgraf}% ... dotted lines ...
  \bigskip% Gap between dots and next paragraph
}
\begin{document}

Here is some text.
\Pointilles{5}

Here is some more text.
\Pointilles[1.5]{3}

Here is some final text.
\Pointilles{2}

\end{document}
|improve this answer|||||
  • Get misplaced lines within enumerate environment; The first line comes indented and exceeds other lines on the right. – Hamed Jun 3 '15 at 21:50
  • 1
    @user22432: Ahhh, well thanks for providing more context. In the future, please provide all details relating to your problem in the form of a minimal example that we can copy-and-paste-and-compile and replicate your setup. Instead of \endgraf in my code, consider using \\. You may have to play around with the \baselineskip values. – Werner Jun 3 '15 at 21:54
  • Excellent! Your solution worked perfectly. Thank you for your help. – Hamed Jun 6 '15 at 9:07
0
\documentclass{article}

\usepackage{ragged2e}

\usepackage{forloop}

\newcounter{loopcntr}

\newcommand{\rpt}[2][1]{\forloop{loopcntr}{0}{\value{loopcntr}<#1}{#2}}

\begin{document}

\begin{FlushLeft}
\noindent Here is some text.
\rpt[3]{\noindent\vbox spread 1cm {}\null\xleaders\hbox to 2mm {\hss . \hss}\hfill \null\newline}
\end{FlushLeft}

\begin{FlushLeft}
\noindent Here is some more text. \newline
\rpt[3]{\noindent\vbox spread 1cm {}\null\xleaders\hbox to 2mm {\hss . \hss}\hfill \null\newline}
\end{FlushLeft}

\begin{FlushLeft}
\noindent Here is some final text.\newline
\rpt[5]{\noindent\vbox spread 0.5cm {}\null\xleaders\hbox to 1mm {\hss . \hss}\hfill \null\newline}
\end{FlushLeft}

\end{document}

enter image description here

|improve this answer|||||
  • 1
    Please give a comprehensive solution and welcome to TeX.SE – Raaja is not active on TEXSE Mar 23 '19 at 10:21
  • Welcome to TeX.SE! It gave me some Underfull \hbox warnings. – user156344 Mar 23 '19 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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