Hot answers tagged

101

This is not a bug; it's a feature. Depending on the bibliography style in use, BibTeX converts all characters in the title to lowercase, with the exception of the first character. If you want to override this, wrap the character(s) in curly braces, e.g., title = "Pascal, {C}, {Java}: were they all conceived in {ETH}?"


80

The loss of capitalization is by design: BibTeX does this because some, but not all citation styles require capitalization in titles (a.k.a. "title case"); other styles use ordinary case. Your bibliography database should work with both capitalization styles without modification, so BibTeX styles are designed to work as follows: You must write the title in ...


30

If you do want to change all the bibliography entries then you can modify your style file. Copy it to mybst.bst and then edit the file to modify the function format.title to: FUNCTION {format.title} { % title empty$ % { "" } % { title "t" change.case$ } % if$ title } Then it didn't change the uppercase letters. Save the new file into your ...


25

It might depend on the style and language(s) you are using, but generally titles are printed in the field format titlecase. By default, titlecase has no effect on casing; from biblatex.def: \DeclareFieldFormat{titlecase}{#1} If you want all titles in sentence case (i.e. first letter capitalized, the rest in lowercase) you can redefine this format: \...


25

hyperref.sty indeed includes the following code snippet (with names sometimes, but not always in uppercase): \def\HyLang@english{% \def\equationautorefname{Equation}% \def\footnoteautorefname{footnote}% \def\itemautorefname{item}% \def\figureautorefname{Figure}% \def\tableautorefname{Table}% \def\partautorefname{Part}% \def\appendixautorefname{...


23

With both latin1 and utf8 encodings I get correct output from \newcommand{\facultad}{IngenierĂ­a} \newcommand{\Facultad}{\expandafter\MakeUppercase\expandafter{\facultad}} \Facultad The problem with your definition is that \uppercase acts on the token list \universidad and doesn't do nothing, because at that level there's no letter to be uppercased; \...


21

The format definition \DeclareFieldFormat{titlecase}{\MakeSentenceCase{#1}} makes all titles in sentence case, which isn't what you want. Titles need to be printed according to both the entry and field types. For example, with the title field we need to handle @article and @book entries differently. With @inproceedings entries we need to handle the title ...


20

i find the cited answer rather confusing, if not out-and-out backwards. \@ before punctuation says that the period does fall at the end of a sentence. to quote from the latex manual (p.170): \@ Causes an "end-of-sentence" space after punctuation when typed before the punctuation character. Needed only if the character preceding the punctuation ...


20

A working scheme seems to be \documentclass{article} \usepackage[authoryear]{natbib} \usepackage{hyperref} \DeclareRobustCommand{\VAN}[3]{#2} \begin{document} \citet{vannoort} \citet{other} \bibliographystyle{plainnat} % here we change the meaning of \VAN \DeclareRobustCommand{\VAN}[3]{#3} \bibliography{vannoort} \end{document} where the entry in the ...


20

If using LuaLaTeX rather than XeLaTeX is an option for you -- fortunately, Lua(La)TeX and polyglossia have started playing nice with each other, beginning a few months ago -- you may achieve your goal as follows. First, define an "OpenType feature file", such as # Scripts and languages # If the font uses others, they should be defined here too ...


20

You can do it with a regular expression, if you have the input string as an argument. \documentclass{article} \usepackage{xparse,l3regex} \usepackage{xcolor} \ExplSyntaxOn \NewDocumentCommand{\colorcap}{ O{blue} m } { \sheljohn_colorcap:nn { #1 } { #2 } } \tl_new:N \l__sheljohn_colorcap_input_tl \cs_new_protected:Npn \sheljohn_colorcap:nn #1 #2 { %...


18

\autoref doesn't do automatic capitalization, as the following example illustrates: \documentclass{article} \usepackage{listings} \usepackage{hyperref} \providecommand*{\lstnumberautorefname}{line} \begin{document} \section{Test}\label{sec:test} \autoref{sec:test} and a period before the reference. \autoref{sec:test} \begin{lstlisting} [escapeinside=||,...


17

Updated answer For expl3 based partly on ideas raised here in my original approach and in Bruno's method we have now developed a set of expandable case-changing functions that implement case mappings as described by the Unicode Consortium: \str_fold_case:n \tl_upper_case:n(n) \tl_lower_case:n(n) \tl_mixed_case:n(n) These functions are still in ...


17

I would say the typographically correct thing would be to use small caps for all-capital letter words, for example CD-ROM would become \textsc{cd-rom}: That way, the hyphen is aligned nicely with the surrounding letters, and the all-caps word doesn't stand out as much. This is also the solution suggested by Erik Spiekerman in his Typo Tips.


17

You could use \MakeLowercase: \documentclass{amsart} \title{Topics on \MakeLowercase{de} R\MakeLowercase{ham} cohomology} \author{The Author} \begin{document} \maketitle \end{document} I am not sure about using lowercase for the last name; perhaps \title{Topics on \MakeLowercase{de} Rham cohomology} could be better?


16

The macro simply says \spacefactor 1000 Under \nonfrenchspacing, capital letters set the space factor to 999 and, by rule, the space factor never jumps from a value less than 1000 to a value greater than 1000. On the other hand, a comma sets the space factor to 1250, the period to 3000 and so on for other punctuation signs. So with JS,, the space factor ...


16

\documentclass[a4paper]{article} \usepackage[latin1]{inputenc} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\capitalize}{>{\SplitList{~}}m}{ \CapitalizeFirst#1\Capitalize\unskip } \ExplSyntaxOff \def\Sentinel{\Capitalize} \def\CapitalizeFirst#1{\MakeUppercase#1 \Capitalize} \def\Capitalize#1{% \def\next{#1}% \ifx\next\Sentinel \...


16

As indicated by lockstep you can use cleveref to have control over case. Simply load cleveref, but make sure to load it after hyperref, and use \cref for lower case cross-references and \Cref for upper case cross-references. Other than being able to handle cases cleveref can handle ranges of labels and more languages than \autoref. Here is an example on how ...


16

\documentclass[a4paper]{article} \makeatletter \DeclareRobustCommand{\emphcap}[1]{\begingroup\emph@cap#1\@nil\endgroup} \def\emph@cap#1{% \ifx#1\@nil \expandafter\@gobble \else \emph@@cap{#1}% \fi \emph@cap} \def\emph@@cap#1{% \ifnum\uccode`#1=`#1\relax \itshape#1\emph@captrue \else \ifemph@cap\/\else\fi\upshape#1\emph@capfalse ...


16

\documentclass{article} \newcommand{\tinycommand}{\hmm{t}iny command} \newcommand\hmm[1]{\ifnum\ifhmode\spacefactor\else2000\fi>1000 \uppercase{#1}\else#1\fi} \begin{document} The desired input: This is some text and a \tinycommand. This is some text. \tinycommand. \end{document} If you use \frenchspacing then you would need \def\frenchspacing{\...


16

This solution shows an active character approach, which (though heavy in the setup) will allow one to have cap letter automatically colorized. But because active letters will tend to break macros, I provide the means to disable it. This revised solution provides the following macros: \capcoloron[color] turns all cap letters to this color (default red) \...


15

\documentclass{article} \usepackage{makeidx}\makeindex \newcommand*{\formatfirst}[1]{\MakeUppercase{#1}} \makeatletter \newcommand*{\mymacro}[1]{% \expandafter\formatfirst\expandafter{\@car #1\@empty\@nil}% \@cdr #1\@empty\@nil} \newcommand*\myMakeUpperCase[1]{% \def\@myuppercasewords{\myuppercase@i#1 \@nil}% {\itshape\@myuppercasewords}\index{#1@\@...


15

Yes and no. The "setting" comes from the style file you use for your bibliography. Changing the style will change the way BibTeX dos or does not use capital letters. You might also try to change the bst file. But given its complicated structure and the fact that a publisher might use his own style / require you to use his, this is usually not a possibility. ...


15

An approach using LaTeX3: the important command is \regex_replace_all:nnN. Its first argument is a regular expression (here, [A-Z] matches any uppercase letter); its second argument the replacement, here \textit followed by \0 (what the regular expression matched); and the third is a token list variable on which we want to do the replacement. \documentclass[...


15

You have to isolate the first token in #1 from the rest and uppercase it; the fact that \uppercase doesn't expand anything and puts back the token list into the input stream after its operation can be exploited in the following way: \newcommand{\mycommand}[1]{\mycommandaux#1\relax} \def\mycommandaux#1#2\relax{% \uppercase{\expandafter\gdef\csname #1}#2\...


14

You could set the \sfcode of the "end of sentence" chars to something different and test for it: \documentclass[10pt]{report} \sfcode`\.=1001 \sfcode`\?=1001 \sfcode`\!=1001 \sfcode`\:=1001 \newcommand\secname{\ifnum\spacefactor=1001 Secname\else secname\fi} \begin{document} abc. \secname\ is \secname. e.g.\@ \secname \end{document} \...


14

The canonical reference for this kind of thing is Nicolas Markey's Tame the BeaST. For your example of HF, enter it as {HF} to keep the capitalisation. Generally, it's better to only put the braces around the minimum part that needs fixed capitalization. Some publications want all UPPER CASE, some want Title Case, some want Sentence case. So for most ...


14

Ok, here is an other approach dedicated to LuaLaTeX fans (and future fans of LuaLaTeX). I think it is a good example to show how easy it is to write a few (easy to understand) lines of Lua code. In the provided Lua code one can check the input string for every char and format any LaTeX string you need without cryptic TeX commands. It is good practice to ...


14

of course, this isn't an answer to "how do i modify my .bib file"... make a "myplain.bst" that is a copy of plain.bst, but replaces FUNCTION {format.title} { title empty$ { "" } { title "t" change.case$ } if$ } by FUNCTION {format.title} { title empty$ { "" } { title } if$ } and then change your document to use myplain.bst instead ...


14

There is a simple solution. You can set the text that appears in the glossary and the text that appears in the... text separatly. \newglossaryentry{uppercase}{ name={Uppercase}, text={uppercase}, description={Appears uppercase in the glossary and lowercase in the text} }



Only top voted, non community-wiki answers of a minimum length are eligible