Question: It seems, by using the command `\setul{}{ pt}` in the `soul` package, we can change the underline width. But I don't want to use this package. Is there any other command for changing the underline width to an arbitrary size, without using any specific package?

Answer: 
**REVISED APPROACH**

Here is `\dunderline[<offset of line top>]{<thickness>}{<content>}`.

EDIT: I took Harald's suggestion to place the macro inside of a group, since `\ooalign` changes `\lineskiplimit`. Without the extra group, the underline can run into the content below on the next line. With the extra group, as shown in the MWE, extra vertical space is inserted to prevent overlap.

EDITED to use egreg's suggestion of `\sbox0{}`, rather than `\setbox0=\hbox{}`.

```
\documentclass{article}
\usepackage{lipsum,xcolor}
\newcommand\dunderline[3][-1pt]{{%
  \sbox0{#3}%
  \ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}}}
\begin{document}
\dunderline{1pt}{This is a test}

\dunderline{2pt}{This is a test}

\dunderline[-.5pt]{2pt}{This is a test}

\dunderline[-6pt]{2pt}{This is a test} \lipsum[1]
\end{document}

```

[![enter image description here](https://i.stack.imgur.com/UiDSb.jpg)](https://i.stack.imgur.com/UiDSb.jpg)

**ORIGINAL OFFERING**

The magnification is arbitrary, but only between 1x and 2x the original thickness. It performs the result with a double underline. Since an underline is .4pt thick, the 1st parameter offset can only vary between 0pt (1x mag) to .4pt (2x mag).

```
\documentclass{article}
\newcommand\dunderline[2][.4pt]{%
  \raisebox{-#1}{\underline{\raisebox{#1}{\smash{\underline{#2}}}}}}
\begin{document}
\underline{This is a normal thickness}

\dunderline[.2pt]{This is 1.5x thickness}

\dunderline{This is 2x thickness}

\end{document}

```

[![enter image description here](https://i.stack.imgur.com/qKvGq.jpg)](https://i.stack.imgur.com/qKvGq.jpg)
Of course, `soul` allows line breaks in underlined material. If you want it, then use `soul`. But you should avoid underlining altogether.

Otherwise, here's a version that is customizable like for `\setul`.

```
\documentclass{article}

\newlength{\myuldp}
\newlength{\myulthickness}
\newcommand{\setmyul}[2]{%
  \if\relax\detokenize{#1}\relax\else
    \setlength{\myuldp}{#1}%
  \fi
  \setlength{\myulthickness}{#2}%
}
\newcommand{\setmyuldepth}[1]{%
  \settodepth{\myuldp}{%
    \if\relax\detokenize{#1}\relax\myulalphabet\else#1\fi
  }%
  \addtolength{\myuldp}{0.9pt}% clearance
}
\newcommand{\myulalphabet}{abcdefghijklmnopqrstuvwxyz}
\newcommand{\myulline}{%
  \leaders\hrule
    height -\myuldp
    depth \dimexpr\myuldp+\myulthickness
  \hfil
}
% initialize
\setmyul{0pt}{0.4pt}
\setmyuldepth{}
%%%

\newcommand{\myul}[1]{{\ooalign{#1\cr\myulline\cr}}}

\begin{document}

\myul{Abcdefghi} \myul{abcyj}

\setmyul{}{2pt}

\myul{Abcdefghi} \myul{abcyj}

\setmyul{1pt}{0.4pt}

\myul{Abcdefghi} \myul{abcyj}

\end{document}

```

An empty argument in `\setmyuldepth` uses the whole lowercase alphabet to decide the depth; an empty first argument to `\setmyul` means “don't change the current value”.

[![enter image description here](https://i.stack.imgur.com/mUovJ.png)](https://i.stack.imgur.com/mUovJ.png)