Smart Quotes

62 views
Skip to first unread message

Loni

unread,
Apr 4, 2025, 12:26:38 PM4/4/25
to yWriter
This is more a question posed to the general group rather than an issue with yWriter. 

When I write in yWriter, I prefer straight quotes. When I export to html for formatting (this goes back to previous posts of mine), the quotes are still straight, which is to be expected. 

For beta-reading purposes, I've copied what's presented in html, and pasted it into Word. I want smart quotes in the final formatting, so I've tried turning on smart quotes in Word and doing a replace all of double quotes and single quotes. While this works for the majority of quotes, there are some where it turns the quotes the wrong way. These instances usually follow italicized text, like this (quotation mark is in red):

If we live through this, I have something I wish to discuss with you…about your mother. He was going to tell me. Blast this bloody war! He was going to tell me, and then he went and died—he and Utheros, same battle.”


This, of course, is a Word problem, not a yWriter problem. But I am wondering if any of you brilliant minds have ideas on smartening quotes in the html stage? It doesn't look to be possible with css, but sometimes people have clever solutions. 

Related to yWriter, the multi-line centering isn't respected when exporting to epub either (I thought maybe a workaround to the smart quotes would be exporting to epub and then converting with smarten punctuation in calibre, but that just reintroduces the centering problem). This is a problem in the docx export that I brought up previously, where it will center the first line, but the ones that follow are left-aligned. Multi-line centering works in RTF exporting and HTML exporting, which is why I've gone the route of html exporting and am now looking for html solutions to smarten quotes. 

I'm also not particularly interested in switching text editors to Libre Office (sorry Peter). I'd rather find a better solution than doing a replace all and crossing my fingers, while never knowing if one of my thousands of quote marks is facing the wrong direction. (I'd actually be fine with the epub/calibre solution if the centering worked right.)

Peter T.

unread,
Apr 4, 2025, 5:37:59 PM4/4/25
to yWriter
On Friday, April 4, 2025 at 6:26:38 PM UTC+2 Loni wrote:
there are some where it turns the quotes the wrong way. These instances usually follow italicized text, like this (quotation mark is in red):

If we live through this, I have something I wish to discuss with you…about your mother. He was going to tell me. Blast this bloody war! He was going to tell me, and then he went and died—he and Utheros, same battle.”


This, of course, is a Word problem, not a yWriter problem. But I am wondering if any of you brilliant minds have ideas on smartening quotes in the html stage? It doesn't look to be possible with css, but sometimes people have clever solutions. 

 
For American English, there are opening quotation marks like "66"" and closing quotation marks like "99".
Generally, the opening quotation marks are preceded by either a line break or a space. A closing quotation mark that is preceded by a space is always incorrect. This is either a typo (misplaced space), or it might be due to a conversion problem with Word. If the conversion problems you mentioned occur in connection with italicized text, you might want to take a look at the raw html code.

So if this is your example text:

 about your mother. ”He was going to tell me.

Is the exported raw html code like this:
about your mother. </i>"He was going to tell me.

Or is it like that:
about your mother.</i> "He was going to tell me.

If you enter both variants and have Word convert the quotes, is the result the same? 

Loni

unread,
Apr 4, 2025, 6:11:27 PM4/4/25
to yWriter
I have verified the HTML source is like this, generated by yWriter:

about your mother.</i> "He was going to tell me.

I did my replace all, and it still resulted in the backward:

about your mother. ”He was going to tell me. 

I manually changed it to the incorrect syntax and it gave me the same backward quote result. 

I got a private response from another user suggesting putting the spaces in my replace. So replace all on [space]" and "[space] individually. That does turn the quote mark the correct direction. (Thank you, John Pilge, btw.) I'll update my process accordingly. But I'll still take suggestions if anyone has an html solution.

I still would like to submit the issue about the epub export not retaining the centering when there are multiple lines of centered text. These lines are separated by carriage returns, therefore end up in their own paragraph tags, but only the first is centered and the ones that follow end up left aligned. 

Peter T.

unread,
Apr 7, 2025, 5:40:23 AM4/7/25
to yWriter
On Saturday, April 5, 2025 at 12:11:27 AM UTC+2 Loni wrote:

I got a private response from another user suggesting putting the spaces in my replace. So replace all on [space]" and "[space] individually. That does turn the quote mark the correct direction. (Thank you, John Pilge, btw.) I'll update my process accordingly. But I'll still take suggestions if anyone has an html solution.

How nice that your problem has now been solved. As I said, opening quotation marks are preceded by a space or a line break. Everything else is then closing quotation marks. (In American English, you may have to consider em-dashes if they are not surrounded by spaces.) On this basis, I published a macro extension for OpenOffice and LibreOffice back in the days of yWriter 5, which solved the problem for me. Like Word, OpenOffice offers automatic conversion, but I wasn't satisfied with it. It looks like you'll have to do some manual work with Word too, but now you know how to do it. Perhaps create a macro?

But I'll still take suggestions if anyone has an html solution.

What do you mean by that? Are you thinking of replacing straight quotes by curly quotes in html files? That should also convert apostrophes, ellipses and dashes, shouldn't it?
If you don't feel like writing a script, have a look at the free *pandoc* file converter. It offers a "--smart" option, but if I'm not mistaken, this is limited to a few output file formats, so you might have to take two steps, depending on the desired output document format. 

I still would like to submit the issue about the epub export not retaining the centering when there are multiple lines of centered text. These lines are separated by carriage returns, therefore end up in their own paragraph tags, but only the first is centered and the ones that follow end up left aligned. 

This is a long-known issue that seems to have never been tackled to date. The point is that formatting in yWriter can span multiple paragraphs, but in HTML and docx, each paragraph must be formatted separately. This is not considered when exporting. 


Simon Haynes

unread,
Apr 7, 2025, 5:51:59 AM4/7/25
to ywr...@googlegroups.com

I still would like to submit the issue about the epub export not retaining the centering when there are multiple lines of centered text. These lines are separated by carriage returns, therefore end up in their own paragraph tags, but only the first is centered and the ones that follow end up left aligned. 

This is a long-known issue that seems to have never been tackled to date. The point is that formatting in yWriter can span multiple paragraphs, but in HTML and docx, each paragraph must be formatted separately. This is not considered when exporting. 


It's on the todo list, but exporting is the most complex part of the program, and I'm always worried about changing one part of the export and breaking another.



Loni

unread,
Apr 7, 2025, 8:25:46 AM4/7/25
to yWriter
> Perhaps create a macro?
That's what I have. It was just doing a single replace all before, but I've updated it to do it twice with the spaces included.

> What do you mean by that? Are you thinking of replacing straight quotes by curly quotes in html files? That should also convert apostrophes, ellipses and dashes, shouldn't it?
The ellipses and dashes are already converted in the HTML export, so I haven't been concerned about them. 

> have a look at the free *pandoc* file converter
I'll give it a look. Thanks!

> but in HTML and docx, each paragraph must be formatted separately
It works in HTML, but I see that it wraps the whole section in a center tag, which it itself is encased in a paragraph tag. <p class='Para'><center></p>  I hadn't realized that the browser let that fly until now. But I can use it as a guide and search out any uses of <center> in the HTML file to make sure I manually update it in the epub. I don't always remember where I did centering in my scenes, but the <center> tag is an easy way to find out. It's a workaround I'm good with.

Simon Haynes

unread,
Apr 7, 2025, 8:37:06 AM4/7/25
to ywr...@googlegroups.com
It's meant to use <p class='centered'> instead of <center>.  I thought I'd changed this some time back, for the same reason you mention (not centering successive paragraphs).  I know that centering doesn't work like bold, italics, etc.

One thing you might like to try - export to ebook instead of HTML, and see if the intermediate html file is formatted any better.


--
You received this message because you are subscribed to the Google Groups "yWriter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ywriter+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ywriter/e6fd00e1-6b51-4090-ab07-0e88d15feb11n%40googlegroups.com.


--

--
Visit Spacejock Software, the home of yWriter, FCharts and more
Visit spacejock.com.au for my articles on writing and publishing novels.

Loni

unread,
Apr 7, 2025, 8:51:08 AM4/7/25
to yWriter
I have been messing with the export to epub (direct export) option, and that is the one that isn't respecting the centering. I haven't tried the multi-file export yet. But the export to epub works well to open it in calibre editor and use its smarten punctuation option. 
Reply all
Reply to author
Forward
0 new messages