# Lower case first character

How do you make a macro that takes 1 argument and forces the very first character to low?

So you could write the following:

\firstToLow{SOME TEXT INPUT OF VARIATING LENGTH}


And then get this output:

sOME TEXT INPUT OF VARIATING LENGTH

It should be supporting hyperref sou I will be able to write this:

\firstToLow{\textit{\nameref{label}}}

• \MakeLowercase SOME TEXT INPUT OF VARIATING LENGTH (without braces) should do the job. – Bernard Sep 5 '14 at 11:42

This is the reverse of \makefirstuc provided by mfirstuc, which converts the first letter to uppercase. You can adapt it to lowercase by redefining \mfirstucMakeUppercase. This behaves similarly to Bernard's comment, but can deal with any text-block font changing command applied to the text, provided the text to be changed is the first argument of the text-block command, as in the example below:

\documentclass{article}

\usepackage{mfirstuc}

\renewcommand{\mfirstucMakeUppercase}{\MakeLowercase}

\begin{document}

\makefirstuc{SOME TEXT INPUT OF VARIATING LENGTH}

\makefirstuc{\emph{SOME TEXT INPUT OF VARIATING LENGTH}}

\end{document}


Alternatively, wrapping it up in a command so that it doesn't interfere with any other use of \makefirstuc:

\documentclass{article}

\usepackage{mfirstuc}

\newcommand\firstToLow[1]{%
{%
\renewcommand{\mfirstucMakeUppercase}{\MakeLowercase}%
\makefirstuc{#1}%
}%
}

\begin{document}

\firstToLow{SOME TEXT INPUT OF VARIATING LENGTH}

\firstToLow{\emph{SOME TEXT INPUT OF VARIATING LENGTH}}

\end{document}


In both cases the result is:

• Almost there. It still interfers a Little bit. When using your example it Works but when I e.g. use this example: \firstToLow{\textit{\nameref{sec:UC4}}} the output becomes: sec:UC4 in stead of the value of the reference. It also gives an error: Argument of \T@nameref has an extra }. – 7heViking Sep 5 '14 at 12:10
• @FireFly3000 You are making it difficult :) – Manuel Sep 5 '14 at 12:17
• @FireFly3000 That's because \MakeLowercase\nameref{sec:UC4} doesn't work. – Nicola Talbot Sep 5 '14 at 12:29
• It does produce some errors when using the @ operator. I have uploaded a working sample here: sharelatex.com/project/5409b0ac60203fdd22253e39 – 7heViking Sep 5 '14 at 13:01
• Using \emakefirstuc instead of \makefirstuc solved this issue for me, so I could use \firstToLow{\nameref{label}} – gjulianm Oct 26 '15 at 12:08
\documentclass{article}
\def\firstToLow#1{\expandafter\firstToLowA#1!!}
\def\firstToLowA#1#2!!{\MakeLowercase{#1}#2}
\begin{document}

\firstToLow{SOME TEXT INPUT OF VARIATING LENGTH}

\firstToLow SOME TEXT INPUT OF VARIATING LENGTH

\end{document}

• Thanks, it is very close. However, it only works when inserting the text directly in the input field but I am doing something like this: \firstToLow{\textit{\nameref{sec:UC4}}} – 7heViking Sep 5 '14 at 11:54
• Btw. I am using the hyperref package for the references. – 7heViking Sep 5 '14 at 11:56
• "This answer was flagged as low-quality because of its length and content." ^^ – T. Verron Sep 5 '14 at 12:21
• @T.Verron: Yes, it is extremely short and of an obscure contents! – user2478 Sep 6 '14 at 8:33
• What is the function of the exclamation marks in \def\firstToLowA#1#2!!? – Hugh Oct 18 '16 at 0:10