http://www.perlmonks.org?node_id=999021


in reply to One-liner to fix LaTeX quotation marks

Perhaps not directly applicable to your post, but nevertheless very useful if you use LaTeX a lot and have to transform non-LaTeX to properly formatted LaTeX: LaTeX::Encode. It has an "intelligent quotes - iquotes" option in its main latex_encode routine.

single or double quotes around words will be changed to LaTeX single or double quotes; double quotes around a phrase will be converted to "``" and "''" and single quotes to "`" and "'". This is sometimes called "intelligent quotes"
So once you have replaced your double quotes by single quotes where necessary, you can run your text through latex_encode to get proper opening and closing quotes.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics