2

Kindly have a look at this code

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\usepackage[small,sf,bf]{titlesec}
 \setromanfont{Georgia}
\usepackage{amssymb} 
\newcommand{\checkbox}{$\square$}
\begin{document} 
If appropriate \checkbox  . Why appropriate, specify? ...........
If inappropriate \checkbox . Why inappropriate, specify? ..............
If appropriate \checkbox . Why appropriate, specify? ...........\\
If inappropriate \checkbox . Why inappropriate, specify? ...........
 \end{document}

How can I make a dotted like, of appropriate length so that it is depressed, fainter, has consistent length so that it occupies the remaining white space in the line or has specified length.

8

What you are probably looking for is \dotfill. Like \hfill, it spreads as much as possible, but inserting dots instead of white space. If you lock \dotfill into a box of fixed width, you get dots of a specific width. The \fillin command takes this width as an optional argument; if it's missing, the width defaults to 3cm.

\documentclass{article}
\usepackage{amssymb}
\newcommand{\checkbox}{$\square$}
\newcommand\fillin[1][3cm]{\makebox[#1]{\dotfill}}
\begin{document} 
If appropriate \checkbox  . Why appropriate, specify? \fillin\ 
If inappropriate \checkbox . Why inappropriate, specify? \fillin[4cm] 
If appropriate \checkbox . Why appropriate, specify? \dotfill\\
If inappropriate \checkbox . Why inappropriate, specify? \fillin[2cm]
\end{document}

enter image description here

| improve this answer | |
4

You can define a macro with an optional variable of the length. If it is not given the dotted line stretches as long as it can (to the end of line).

\documentclass{article}
\usepackage{amssymb}
\newcommand{\checkbox}{$\square$}
%%%%%
\makeatletter
\newcommand\answerline{\@ifnextchar[%]
  \answerlinetowidth\answerlinetoeol}
\newcommand\answerlinetowidth[1][0pt]{\hbox to #1{\leaders\hbox to \answerdotsep{\hss.\hss}\hfill}}
\newcommand\answerlinetoeol{\leaders\hbox to \answerdotsep{\hss.\hss}\hfill\strut}
\newcommand\answerdotsep{6pt}
\makeatother
%%%%%
\begin{document}
\noindent
If appropriate \checkbox. Why appropriate, specify? \answerline[3cm]
If inappropriate \checkbox. Why inappropriate, specify? \answerline[3cm]
If appropriate \checkbox. Why appropriate, specify? \answerline\newline
If inappropriate \checkbox. Why inappropriate, specify? \answerline[3cm]

\end{document}

enter image description here

In the definition of \answerline there is a check if an optional argument is given, and then chooses one of the two following commands (first one with optional argument and the second without).

| improve this answer | |

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.