I use package cleveref
to refercence a figure or table in latex.
\usepackage{hyperref}
\usepackage{cleveref}
\cref{sim_figure}
The result is some like fig. 1
, table I
.
However, my expected result is Fig. 1
or Table I
which is required by IEEEtran. How can I capitalize the first letter?
To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.
The first letter of a string can be capitalized using the capitalize() function. This method returns a string with the first letter capitalized. If you are looking to capitalize the first letter of the entire string the title() function should be used.
In cell B2, type =PROPER(A2), then press Enter. This formula converts the name in cell A2 from uppercase to proper case. To convert the text to lowercase, type =LOWER(A2) instead. Use =UPPER(A2) in cases where you need to convert text to uppercase, replacing A2 with the appropriate cell reference.
This is clearly outlines in the cleveref
documentation.
You can either use \Cref
, or pass the package option capitalise
:
\documentclass{ieeetran}
\usepackage{hyperref}
\usepackage[capitalise]{cleveref}
\begin{document}
See \cref{fig:myfigure} or \Cref{fig:myfigure}.
\begin{figure}
\caption{Some figure}\label{fig:myfigure}
\end{figure}
\end{document}
If you wish to customize the way \Cref
prints (output Fig.
rather than Figure
), add
\Crefname{figure}{Fig.}{Figs.}% {<type>}{<singular>}{<plural>}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With