# custom indent length

How can I apply custom length of indent by giving a "precise word length" instead of estimate numbers under trial and error e.g. x pt or x mm?

• For a single paragraph \settowidth{\hangindent}{\textbf{A Shot Head: }} will work. Sep 29 '15 at 4:00
• possible duplicate tex.stackexchange.com/questions/263765/… Sep 29 '15 at 4:01
• @JohnKormylo - Using the \settowidth approach isn't quite sufficient: If the right-hand edges of the paragraph are justified, the actual head text has to be encased in an \mbox in order to "freeze" the widths of any interword spaces.
– Mico
Sep 29 '15 at 5:25

You could use the \settowidth macro to set the value of the \hangindent length parameter to the width of a chosen string.

Note: If you use hanging indentation, and assuming the right-hand edges of the paragraph are justifed, it's necessaryto encase the head element -- "A short head", "A much longer head", etc -- in an \mbox in order to keep LaTeX from stretching or shrinking any spaces that may occur in the lead text. Placing the head element in an \mbox "freezes" the widths of the interword spaces.

\documentclass{article}
\usepackage{parskip} % no \parindent, \non-zero parskip

\newcommand\dummytext{This is a long sentence that will extend to the second line. I want the second line indented by the length of the head words.}

\begin{document}