I have a text that uses degree marks ('or'') instead of proper quotation marks (e.g.,“,”).

How can I modify the text so that proper quotation marks display? I tried using the csquotes package (\usepackage[style=british]{csquotes}) but it had no effect on the text, unless there is some other magic to using this package (such as defining degree marks, but I didn't see anything in the documentation, v.5.1b)

I know that ` should be used instead of the degree(') mark, but the text didn't come that way. I can't do a find and replace because the same degree mark is used for beginning and ending quotes. And there are double quotes (”) as well. Hundreds of them.

Other than some SED or AWK artistry, is there an easy way to do this?

(The reason why I mention SED artistry is that I once indexed a large file going from specific to general instead of vice-versa. On a 400 page book SED made the necessary changes almost instantly.)

  • There might be an easy way to do it using your preferred text editor. Can you tell us which editor you use?
    – James
    Jun 1, 2015 at 14:44
  • You could try a search+replace using regular expressions (asking for confirmation, of course)?. Something like : Search for "\(*\)" and replace with “\0”. I also would suggest using UTF8 input encoding, and typesetting directly the right quotes.
    – Bernard
    Jun 1, 2015 at 14:45
  • 1
    An added complication with the single degree ' mark (aka apostrophe) is that it is primarily used for contractions and possessive cases, and so any automatic approach at trying to convert two such marks into proper LaTeX single quotes is not possible. Jun 1, 2015 at 14:45
  • 1
    I believe you have to use macros provided by csquotes for it to do anything. I dont believe this is possible for the general case as just finding pairs of ' or " isnt necessarily going to be correct, which is why different characters are used in TeX. If you can assume ' or " are paired then you could, but at least for ', this seems like a bad assumption.
    – Matt
    Jun 1, 2015 at 14:47
  • @Steven B. Segletes: Entirely automatic would be risky, but some editors ask for confirmation at each occurrence.
    – Bernard
    Jun 1, 2015 at 14:50

1 Answer 1


First, they’re not degree marks, they’re uni-directional apostrophe/single quotes and double quotes. The correct symbol for degree marks are primes and double primes, ′″.

Second, while one can work up a GREP to do this, it’s only as reliable as the initial tagging and will break on constructs such as:

“She was 5′2″, with eyes of blue, ‘’struth’.”

You need to go through the entire document and verify which should be:

  • opening double quotes
  • closing double quotes
  • apostrophes / closing single quotes
  • opening single quotes
  • primes
  • double primes

While doing so, you might want to properly tag it so that quotes are differentiated from other structures so that the document can be properly switched from American to British-style quotations (and vice-versa).

  • "properly tag it", can you explain how that is done also?
    – jonalv
    Jun 1, 2015 at 14:49
  • 2
    @jonalv the easiest way would be using \enquote{...} for the quoted stuff, and a special, maybe self-declared macros instead of the other literal uses.
    – Juri Robl
    Jun 1, 2015 at 15:08
  • The two stackoverflow links mentioned by @jknappen above contain one awk and two sed implementations which solve the problem easily. This should really be the answer. Jun 25, 2015 at 9:41
  • In what ways do the two scripts which you cite mangle the example which I provide? I’ll bet long odds and family heirlooms they don’t work on it correctly.
    – WillAdams
    Jun 25, 2015 at 12:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .