Xetex – Dotted Line with Appropriate Length for Answering a Question

linexetex

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.

Best Answer

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