In an Indesign document, I have two kinds of paragraphs: Normal (English) text, and source code snippets. In the normal text, Indesign is very clever, so I get nice typographers quotes, and all is well. But I also get typographers quotes in the source code paragraphs, where plain quotes should be used. How can I tell Indesign to leave the quotes alone in the source code paragraphs?
You cannot. "Use Typographers' Quotes" is a system-wide setting, not applicable to separate paragraph or character styles. And InDesign does not 'know' what code is and what is not, so it changes typed straight quotes to curly ones when the setting is on and not when it's off.
That said: where does your text come from?
If typing in InDesign: the Typo Quotes preference can be switched on and off with one of the default hotkey combo's. You can also always leave it switched on and directly enter straight single and double quotes, or leave it switched off and directly enter curly quotes. Check your keyboard shortcuts -- the default set defines keys for all of these.
If importing existing text into InDesign: are they already correctly 'curly' and 'straight' in the original file? If yes, then check your Import settings. There is a checkbox for changing quotes, or leaving them as they appear in the original file.
None of this helps you for the text you already have; changing the global settings will not automagically alter the existing quotes. To find and change quotes from curly to straight in code only, you can use regular Text Find/Changes:
Single: search for
', change to
Double: search for
", change to
With both you need to make sure it only operates on your code; easy if you used a specific Paragraph or Character style for code, else you need to fill in the font you used.
Some additional tips for free 😄
- Make sure ligatures are switched off in your code! Nothing mystifies programmers more than seeing an
ﬁas a single character inside every
modiﬁer. It also messes up any vertical alignment.
- Entire paragraphs of code should be left aligned, without any hyphenation.
- Set your tabs to a multiple of 4, 6, or 8 spaces. Simply type the number of spaces and look in your Control Bar to see how wide that is for your font and size.