Tag Info

Hot answers tagged

32

This is not a bug; it's a feature. 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 brackets, e.g., title = "Pascal, {C}, {Java}: were they all conceived in {ETH}?"


30

From Donald Knuth's TeXbook, p. 1: The correct way to refer to TeX in a computer file, or when using some other medium that doesn’t allow lowering of the ‘E’, is to type ‘TeX’. The same is true for LaTeX and all others.


23

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. So BibTeX styles are designed to work as follows: You must write the title in the capitalized form, and your bst style either keeps it this way or converts it to lower ...


20

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 ...


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 ...


19

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 { ...


17

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: ...


17

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 ...


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.


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

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 ...


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) ...


16

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 ...


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 ...


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. ...


15

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; ...


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 ...


14

\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}% ...


14

Our own Martin Scharrer's collcell package is ideal for this sort of thing: \documentclass{article} \usepackage{array} \usepackage{collcell} \newcolumntype{U}{>{\collectcell\MakeUppercase}c<{\endcollectcell}} \begin{document} \begin{tabular}{cU} a & b \end{tabular} \end{document}


14

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}% ...


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

\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 ...


13

You have to tell acronym both spellings: \documentclass{article} \usepackage{acronym} \usepackage{etoolbox} \makeatletter \newif\if@in@acrolist \AtBeginEnvironment{acronym}{\@in@acrolisttrue} \newrobustcmd{\LU}[2]{\if@in@acrolist#1\else#2\fi} \newcommand{\ACF}[1]{{\@in@acrolisttrue\acf{#1}}} \makeatother \begin{document} \begin{acronym} ...


13

From the Wikipedia entry on the pronunciation and writing of "LaTeX": The name is traditionally printed with the special typographical logo [...]. In media where the logo cannot be precisely reproduced in running text, the word is typically given the unique capitalization LaTeX. The same goes for the word TeX.


13

Computer Modern's greek (bottom) font is (loosely) based on Monotype's 155M Greek font (top): The Monotype 155M font itself is related to the Porson greek font, which was one of the most used typeface for greek in english speaking countries. One of the characteristic of this font is that it has upright capitals but slanted lowercase. This might seem ...


13

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 ...


13

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 ...


12

Consider rather writing a macro for this type of issue. For example you can create a command for your example as follows: \newcommand{\yaweh}{% \emph{Y}a\emph{W}e\emph{H} } The advantage of this, is that also your mark-up can be more meaningful. As per request and a bit of a different approach to egreg's solution. \documentclass{article} ...


12

Please always post complete documents, not just fragments. TeX is in vertical mode at that point, so you can do: \documentclass{article} \newcommand\wufen{\ifvmode W\else w\fi ufen} \begin{document} \begin{enumerate} \item \wufen\ something something \item Something \wufen\ something... \end{enumerate} \end{document}


12

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} ...



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