Replace normal double quote with Latex double quote
By default Latex formats "
as an end quote. If you have a document with sentences which start with "
, the formatted document can look awkward with sentences starting with end quotes.
To replace them with ``
so that Latex formats them as opening quotes, you can use sed. Save the following code in a text file:
# This is for lines which start with double quotes, but do not end with them s/^"\([^"][^"]*$\)/``\1/g # This is for sentences which both start and end with double quotes s/"\([^"]*"\)/``\1/g
Save the file as dblQtReplacer. Now run your Latex file through sed:
sed -f dblQtReplacer latex_file.tex > new_latex_file.tex
WoW…. Really Superb…
Thanks a lot..
This helped me a lot and saved my time too 🙂
Arulalan.T
June 10, 2010 at 00:00
Sweet! Just what I needed… I didn’t want to have to figure out those regular expressions for myself 😛
Steve
June 12, 2010 at 07:22
# Formats Quotes in LaTeX
# ‘quote’ -> `quote’
# “quote” -> “quote”
s/\(\s\)’/\1`/g
s/\(\s\)”/\1“/g
s/\([^“]*\)”/\1”/g
Dustin Dorroh
March 2, 2011 at 09:36