How can one turn regular quotes (i.e. ', ") in

2020-05-28 21:00发布

Given a document written with normal quotes, e.g.

Ben said "buttons, dear sir".
I replied "Did you say 'buttons'?" to him.

What ways can one turn these sort of things into LaTeX quotes, with the appropriate semantics. i.e.

Ben said ``buttons, dear sir''.
I replied ``Did you say `buttons'?'' to him.

So that LaTeX produces:

Ben said “buttons, dear sir”.
I replied “Did you say ‘buttons’?”

My first thought is to turn to a regex. However, I'm not getting any hits from Google or the regex libraries for "LaTeX quotes regular expression", and of course "TeX quotes regular expression" seems to return too many.

Thank you.

7条回答
该账号已被封号
2楼-- · 2020-05-28 21:23

Do not use regular expressions for this kind of task!

Maybe you can get some inspiration from SmartyPants?

查看更多
登录 后发表回答