10

With the following entry in the .bib file

@ARTICLE{a1,
AUTHOR="M., J. J.",
TITLE="My Sample Title",
JOURNAL="Journal Name",
pages="132--234",
YEAR=2000`
}

and with \bibliographystyle{plain} in the preamble, my PDF output displays the reference title with lower case, except for the first letter: "My sample title". How could I state that the title should be shown in PDF as I write it in the .bib file?

lockstep
  • 250,273
boy
  • 1,525
  • 2
    Afaik you could enclose the first letter into {} like My {S}ample {T}itle. But I haven't tried it and I really doubt that this is the best way ... – Thorsten Apr 23 '12 at 14:25
  • 2
    Of course I could do so. The problem is that the .bib file I have on disposal has around 600 entries. – boy Apr 23 '12 at 14:42
  • If you're a Vim user, you could add the braces with :g/^TITLE=/ s/\<\([A-Z]\)\([a-z]*\)\>/{\1}\2/g. – Martin Apr 23 '12 at 15:22
  • 1
    The problem with this approach is that when using a .bst that is supposed to render titles with sentence capitalization, everything breaks.

    The decision about whether to have titles in sentence caps or Title Caps is a publisher decision. Using braces to "protect" literal caps is only really supposed to be used for proper names and acronyms, since poor BibTex can't be expected to recognize these and leave them capitalized.

    It seems like I spend have my life as an editor fixing .bib files made by people who were overenthusiastic about protecting content. Please don't do this.

    – Peter Castine Jan 16 '23 at 18:28

2 Answers2

19

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 of plain.bst

do not, under any circumstances, change your plain.bst file! ... changing a fundamental part of the distribution will lead to tears, later.

wasteofspace
  • 5,352
  • Thanks. Could you be more specific on 1) where I could find plain.bst file, and 2) where do I specify that my .tex file uses "myplain.bst" file instead of "plain.bst"? – boy Apr 23 '12 at 20:07
  • I suppose that changing \bibliographystyle{plain} to \bibliographystyle{myplain} would suffice for the second part, but I still need access to plain.bst file. Where could I find it, and should I place myplain.bst in the same directory with plain.bst? – boy Apr 24 '12 at 15:28
  • The answer found here: http://tex.stackexchange.com/questions/31747/how-can-i-get-the-style-alpha-bst-sorted-as-plain-bst-in-bibtex – boy Apr 24 '12 at 19:41
-1

a simple solution: change all the entries of your database:

sed '/title/s/}/}}/' yourfile.bib > tmp.bib
sed '/title/s/{/{{/' tmp.bib > yourfile.bib
rm tmp.bib


Updated solution:

sed '/TITLE/s/"/{{/' yourfile.bib > tmp.bib
sed '/TITLE/s/"/}}/' tmp.bib > yourfile.bib
rm tmp.bib
Luca
  • 1
  • Welcome to TeX.SX! Probably that's not what the OP wanted (not really LaTeX). – TeXnician Jun 05 '17 at 10:15
  • Will this approach work if the contents of the title field are enclosed by double quotes instead of curly braces? – Mico Jun 05 '17 at 10:18
  • By the way, the .bib file has fields delimited with quotes, not braces. – egreg Jun 05 '17 at 10:23
  • Ty egreg. I updated the answer (Mico, now it works for titles enclosed in double quotes.). – Luca Jun 19 '17 at 18:03
  • I prefer this solution. However it has several issues: it didn't exclude booktitle field updating; when the right brace is not the same line as title, it is not updated; when there are existing {{ or }}, it is not filtered out; when there are multiple { or }, it will only replace the first occurrence. – Hongxu Chen Oct 14 '19 at 06:17