Argumentless macros for use in other macros

I'm in need of argument text formatters for use in some environments that use macros to redefine properties (e.g., enumitem).

I need to underline text but there is no equivalent argumentless macro (what do you call these types of macros? They seem to be important in some cases but I can't easy find info on them) that does this.

http://en.wikibooks.org/wiki/LaTeX/Fonts#Font_styles

I can use \bfseries in my macros: e.g., \setlist[1]{style=standard,label=\\,before=\huge\color{black}\bfseries} Here \textbf does not work since it requires an argument.

I need an equivalent for \underline and/or \emph, e.g.,

\setlist[1]{style=standard,label=\\,before=\huge\color{black}\ulseries}

All the 4a___s should be underlined(the 3rd level)

\documentclass[11pt]{article} % use larger type; default would be 10pt
\usepackage[margin=0.4in]{geometry}
\usepackage{booktabs}
\usepackage{enumitem,color}
%\usepackage[normalem]{ulem}

%\useunder{\uline}{\ulined}{}

\setlist[1]{style=standard,label=\\,before=\huge\color{black}\bfseries}
\setlist[2]{style=standard,label=\\,before=\large\color{black}\bfseries}
\setlist[3]{style=standard,label=\\,before=\normalsize\color{black}\mdseries\slshape}
\setlist[4]{style=standard,before=\small\color{black}\mdseries\normalfont\itshape}

\begin{document}

\begin{itemize}
\item item Root) \hfill
\begin{itemize}
\item item2
\item item3
\item item4
\begin{itemize}
\item item 4a
\begin{itemize}
\item 4ai
\item 4aii
\end{itemize}
\item item 4b
\begin{itemize}
\item 4bi
\end{itemize}
\end{itemize}
\item item 5
\end{itemize}
\clearpage\huge\item Noon \hfill \\
\end{itemize}

\end{document}

• These are called 'switches' usually. For underlining specifically, see Custom switches (such as for underlining). This isn't quite the general solution you are looking for, however. It's not clear that \emph itself can be made into a switch, but for your purposes I don't see why you couldn't just use \itshape instead. – Alan Munn Apr 13 '15 at 0:45
• @AlanMunn I do use \itshape but I've used some package ulem to turn emph into underline. Either case I need to underline and \itshape doesn't do that. \emph and \underline do not work. – user4780446 Apr 13 '15 at 0:52
• I've also tried the ulined link you send but when replacing \bfseries nothing chances(except the bf part). It may be a n issue with enumitem. – user4780446 Apr 13 '15 at 1:02
• If you have 1000 items underlined, and (?) 1000 items in italics, and (?) 1000 items in bold, I hope you have 1000^3 items in a regular 'Roman' font...! More seriously, though, underlining is (AFAIK) usually 'delimited' for TeXnical reasons. I'm not sure a robust \ulseries command is that feasible. – jon Apr 13 '15 at 1:17
• Underlining is different. In the other cases, you are switching to a different font - a different weight, size or shape and/or family. But that's not available for underlining. There is no underlined font in most font families. Unless you are using a family which includes such a font, this cannot work in anything like the same way. How about using colour? Or upright italics or bold and italic or something? Anything where there is a font you can switch to. – cfr Apr 13 '15 at 1:34

Font switches such as \itshape, \mdseries and \scshape tell LaTeX to switch to a different font. The font LaTeX switches to depends on the currently active family, and the various fonts corresponding to the different attributes (weight, shape etc.) are usually defined in a font definition file.

Simplifying reality somewhat, when you say \itshape this is roughly what happens: LaTeX looks for a mapping from {current family + current series + current size + italic shape} to a font. Provided it finds this mapping, it switches to typesetting with that font.

The same thing is true for size switches such as \large except that, in this case, LaTeX may scale the font by an appropriate factor if necessary. Again, the switch causes LaTeX to switch to typesetting with the appropriate font.

If you had a font family which included an underlined font, then you could extend this system to provide similar switches for underlining. However, most font families do not provide such a font. Instead, underlining is added onto the existing characters as part of typesetting. So the font you are getting stays the same. All that changes is that a line is also drawn in the appropriate place.

But typesetting stuff and drawing a line under that stuff is very different from simply typesetting stuff in a different font. So it is not possible to extend the font switching commands to cover this case because you are not actually switching fonts at all. You are instead continuing to use your current font and drawing lines under it.

So the cases are disanalogous and underlining cannot be supported in the same way as a switch to a different font, unless a pre-underlined font is available as part of the current font family and appropriate extensions to LaTeX's font-handling facilities are defined.

I'm not aware of any readily available font family which provides a pre-underlined font. To demonstrate the way in which the font handling of LaTeX can be extended, therefore, I'll use the non-standard upright italic of Latin Modern.

By default, there is no high level way of accessing this font. To use it, you would need to use lower level font-switching commands and ensure appropriate mappings. However, the shape can be accessed if you use the cfr-lm package. This provides an extended set of font definition files for Latin Modern. In addition, it loads nfssext-cfr which provides commands analogous to the standard LaTeX font switches. For example \uishape enables the upright italic shape in approximately the same way as \itshape enables the regular italic shape in standard LaTeX.

So you could use upright italic for the third level of the itemisation, which is easier to distinguish from the oblique shape than the regular italic.

For example:

\documentclass{article}
\usepackage{enumitem,color}
\usepackage[rm=lining,sf=lining,tt=lining]{cfr-lm}

% Note that style=standard has no effect: in a description, it is default; in an itemize or enumerate, it doesn't apply
\setlist[itemize]{before=\color{black}}
\setlist*[1,2,3,itemize]{label={}}
\setlist*[1,2,itemize]{before*=\bfseries}
\setlist*[1,itemize]{before*=\huge}
\setlist*[2,itemize]{before*=\large}
\setlist*[3,itemize]{before*=\normalsize\mdseries\uishape}
\setlist*[4,itemize]{before*=\small\normalfont\slshape}

\begin{document}
\begin{itemize}
\item item Root)
\begin{itemize}
\item item2
\item item3
\item item4
\begin{itemize}
\item item 4a
\begin{itemize}
\item 4ai
\item 4aii
\end{itemize}
\item item 4b
\begin{itemize}
\item 4bi
\end{itemize}
\end{itemize}
\item item 5
\end{itemize}
\item Noon
\end{itemize}
\end{document}