We’re using a monospace font (Courier New) to show programming code in a book and automatically getting smart quotes applied to it (i.e. start and end quotes are angled instead of straight).
Is there a way to stop Pressbooks applying smart quotes to a section of the text, or to add this to the theme as a whole? Our author says that the smart quotes will cause an error if his students copy and paste them.
The way many authors do this is to use pre and code tags around the code snippet <pre><code>print("hello")</code></pre>
They add the code directly in the Code editor (as opposed to the Visual editor) in Pressbooks.
A few things to consider:
- the quotes you enter must already be straight quotes (this may not be the case if content is copied from Word or Google Docs)
- any literal
<, >, or & inside the code must be escaped as <, >, &
<pre> doesn’t wrap lines typically, so you may have to add custom CSS to achieve that if desired
- this should work well for the Webbook and probably the EPUB, it probably would not work for the PDF
Thanks! That worked for us 