45

I want to know how can I achieve this effect in LaTeX:

enter image description here

Basically it looks like this: {F}IRST {L}ETTER, where the letters in the braces are a little bigger than the other ones but they all the letters are uppercase.

Any suggestions?

migrated from stackoverflow.com May 17 '12 at 23:37

This question came from our site for professional and enthusiast programmers.

67

You are most likely referring to small caps:

\textsc{First Letter}

or

{\scshape First Letter}
0

One can adapt expl3 code that egreg published in TUGBoat recently (TUGboat, Volume 39 (2018), No. 1, pg.55). Like Werner's solution using small caps, this solution assumes that the leading letters are entered as capitals. However, you can choose the size (and by extension other attributes)

\documentclass[11pt]{article}
\usepackage{xparse}
\usepackage{expl3}

\ExplSyntaxOn
\NewDocumentCommand{\biglittlecap}{m}
{
\sheljohn_biglittecap:nn { #1 }
}
\tl_new:N \l__sheljohn_biglittecap_input_tl
\cs_new_protected:Npn \sheljohn_biglittecap:nn #1
{
% store the string in a variable   
\tl_set:Nn \l__sheljohn_biglittecap_input_tl { #1 }
\regex_replace_all:nnN
% search a capital letter (or more)
{ ([A-Z]+ | \cC.\{?[A-Z]+\}?) }
% replace the match with \huge{match}
{ \cB\{\c{huge}\1\cE\} }   % <=== could use large, Large (or some other command...)
\l__sheljohn_biglittecap_input_tl
\tl_use:N \MakeUppercase{\l__sheljohn_biglittecap_input_tl}
}
\ExplSyntaxOff

\begin{document}

\biglittlecap{\`Once \r{U}pon a Time}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.