TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a casebook with a law professor using TexShop, and a large portion of project are legal cases, all of which have "quotes" and not ``quotes''

I know the programming difficulties of auto-replacement, but anything is better than doing this manually for four hundred pages of material.

I am not looking for a magic button, but what would be great is a workflow for converting quote marks before putting the cases into the latex document.

I know this is an old problem, and I know a perfect solution is not feasible, but something quick and dirty that works with copy and pasting large blocks of text would make me a very happy person.

share|improve this question
I personally would just do a search&replace for ` "` (note the leading space) to only catch quotes in front of words. – Martin Scharrer Jun 30 '11 at 17:16


To replace all or most of the left-quotes, use something like this:

sed 's/"\([a-z]\)/``\1/g' < infile > outfile

Then the only quotes left will hopefully be right-quotes, so you can just find and replace them with two single quote marks.

share|improve this answer
While I read XKCD on a regular basis, I still don't know how to take a command line suggestion like that and actually use it to edit files. – LawMan Jun 30 '11 at 18:50
So the sed suggestion wins the day! Here is the final sed code I am using: s/"\([a-z]\)/``\1/g s/"/''/g s/§/ \\S \\ /g s/&/\\&/g s/\$/\\\$/g If anyone has any lines to suggest that would be great. One that would be very helpful would be to auto delete 123*456 page references. I used texhelpers sed program as a gui front end. – LawMan Jun 30 '11 at 19:54
@LawMan: If sam's answer solves your problem, you should up vote it and accept it. It looks like you have another question as well, but I can't figure out what exactly you mean. In any case, you should ask it as a separate question, possibly on stackoverflow as it seems like it doesn't have anything to do with TeX (but I could be wrong about that). – TH. Jun 30 '11 at 20:14
Can't vote up, not enough rep. – LawMan Jun 30 '11 at 21:06
I think it's better to use \enquote{} from csquotes package. That way you can easily fix quotes whenever you change language, etc. Here is my exemplary style I had to define for Polish texts: \DeclareQuoteStyle{polish}{\quotedblbase}{\textquotedblright}{\quotesinglbase}{‌​\textquoteright} – przemoc Jun 30 '11 at 23:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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