[Tugindia] capitalization of the first letter in a sentence

S. venkataraman svenkat at ignou.ac.in
Fri Jun 9 07:49:43 CEST 2006


Is it possible to detect if a macro is expanded at the beginning of a
sentence and thereby capitalize the first letter? Say I have a macro

\newcommand{\fref}[1]{figure \ref{#1}}

and a sentence begins with \fref{}. In this case how do I capitalize
the "f" in the "figure"?

When I first read your mail, no solution occurred to me.
Yesterday I read the documentation of varioref package, which 
is a part of tools bundle.  There is a solution to your problem 
there.  Load the package with \usepackage{varioref}. You should put
\labelformat{figure}{figure~#1} before
\begin{document}. You can then use the command \Vref it provides. This 
automatically capitalised the first letter if the \Vref command is given

at the beginning of a sentence.  I think this will solve your problem.
You can do this for any environment. For example, after giving the 
command \labelformat{equation}{eqn.~#1}, it will work with equations. 
You can refer to the documentation of varioref for more details.
Best regards,
S. Venkataraman

More information about the tugindia mailing list