10-13-2023, 08:51 AM | #1 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2021
Device: Kobo Forma
|
En-dash option for smarten punctuation
Hi,
I was just testing out the "Polish books" feature for the first time, and noticed that it replaced double hyphens with em-dash, even if there are spaces to either side of them. The same happens in the Edit book → Tools option for this. The usual convention I am used to seeing is either having an en-dash with spaces, or much more rarely, an em-dash without any spaces (typically I only see this in more antiquated sources). I.e.: "...text -- text..." → "...text – text..." "...text--text..." → "..text—text..." Maybe there are other conventions/preferences over this, but it would be very much appreciated if there was at least an option to use en-dashes instead of em-dashes. |
10-13-2023, 12:01 PM | #2 |
creator of calibre
Posts: 44,566
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
this comes from the smarted punctuation python library, I'm afraid adding configuration UI for this is not wortht he effort at least for me, patches welcome.
|
Advert | |
|
10-13-2023, 01:44 PM | #3 |
the rook, bossing Never.
Posts: 12,379
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
USA vs elsewhere is different for em dash and en dash as an aside. USA uses em dash and no spaces and most other places, esp. UK & Ireland use en dash with a space before and after. This is only asides, the equivalent of (and) or , and aside, etc.
If I'm fussed I fix after by detecting all non-aside em dash and replacing with ¬ then em dash with space en dash space, then ¬ to em dash. Likely there is a smarter way. The Smarten Punctuation fixes single straight quotes and double quotes and makes em dashs with no spaces. |
10-13-2023, 07:52 PM | #4 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
One way to get around this is to:
First in case you want to keep the double hyphens as they are:
Or if you want to convert them to anything else
Last edited by capink; 10-13-2023 at 07:58 PM. |
10-14-2023, 12:43 PM | #5 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2021
Device: Kobo Forma
|
Thank you all for the responses. Yes, I am using the Find/Replace functionality as a workaround which is not a big deal if it is difficult to change the smarten punctuation feature.
|
Advert | |
|
10-15-2023, 10:13 AM | #6 |
Addict
Posts: 304
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
|
I use en dash and em dash quite a bit. To make them I employ both the calibre snippets and also .XCompose. I found out to my horror from a prior post reply that Amazon will not recognize the em dash, so I fudge it by 'running together' 3 regular dashes with a span whose spacing has been reduced. I use the triple sometimes to surround page numbers at bottom of PDF pages. You can set up an .XCompose file in Home and use it elsewhere (not just calibre tag editor). While in calibre I prefer using snippets for en and em dashes. I break USA convention (if, indeed, those rules still apply) by separating like this: text space en dash space text. That is, I do not allow the en dash to touch text (as is the convention). I find that it is even worse looking when done as follows: text comma en dash space text. This was done frequently a century ago by many authors. Or, maybe the type setter did this. I use the triple dash like this for mid-chapter centered scene breaks: em dash space scene space em dash. Best regards, Pop
|
10-15-2023, 11:33 AM | #7 |
the rook, bossing Never.
Posts: 12,379
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Sure em & en both work on Amazon upload to KDP. Why do you think em dash doesn't (which is odd as Amazon is US)?
On Linux I disable Caps Lock Key, both shift is Caps lock, either cancels and then Compose mapped to Caps Lock Key. The Compose --- is em and Compose --. is en as standard. I do have a custom .Xcompose too, but only needed for Greek, prime, double prime like 6′ 2″ ( Using Compose 0 ' and Compose 0 ", where 0 is Zero.) and a few other unusual things as Alt Gr and Compose cover Spanish, French, German, Polish, Icelandic etc. I've no need to type Hebrew, Arabic, Thai, Hindi, "modern" Korean or Cyrillic, but these can be done by swapping layouts or in .Xcompose. The advantage of .Xcompose is using a transliteration rather than official language layout. Years ago I made my own layouts using MS Keyboard Editor thing on XP to match the AltGr of Linux. I've no idea why the regular MS UK or US layouts are so limited. Last edited by Quoth; 10-15-2023 at 11:44 AM. |
10-15-2023, 11:48 AM | #8 |
Resident Curmudgeon
Posts: 76,495
Karma: 136564766
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Can the smarten punctuation be changed to replace en-dashes with em-dashes and remove any spaces?
|
10-15-2023, 12:28 PM | #9 | |
Addict
Posts: 304
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
|
Quote:
|
|
10-15-2023, 02:22 PM | #10 |
Bibliophagist
Posts: 40,604
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Hmmm... That could be a horizontal bar ( ― ), a 2em dash ( ⸺ ) or a 3em dash ( ⸻ ) all of which I've seen used. All too often, what gets displayed is a notdef character. The actual character will depend on the font, some common examples in the attached graphic. Others may be used depending on what is set for glyph 0 in the font.
|
10-16-2023, 05:32 AM | #11 |
the rook, bossing Never.
Posts: 12,379
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
An actual em dash, en dash and hyphen dash covers all uses for ordinary readers of ebooks. All other dashes should only be in PDFs for paper and are very specialist (maybe maths or textbooks). The regular hyphen only for when it's used, not to indicate word breaking on flowing text except on web pages. The minus only for paper print.
|
10-16-2023, 05:37 AM | #12 | |
the rook, bossing Never.
Posts: 12,379
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
Maybe the odd app based on Webkit might render everything a browser on a web page can (and even on web pages there are idiots that use Chrome features). No physical ereader will do bleeding edge CSS, or all of HTML 5 or even all of epub3. |
|
10-18-2023, 03:03 PM | #13 | ||||
Wizard
Posts: 2,304
Karma: 12587727
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Once you install it, you can get multiple options in a dropdown:
The 4th one is exactly what you want to have enabled. Quote:
should not be used like that. Instead, it's better to create those lines via CSS. That was one of the first questions I asked MobileRead wayyyy back in: - - - Side Note: If you want to know the proper use-cases for two + three em dashes, see my post in: Long story short:
I also strongly recommend against using those 2 dash characters, because of all the missing font + problematic rendering issues. Instead, use the equivalent amount of normal EM DASHes. - - - Quote:
Quote:
I cover all the use-cases + spaced vs. non-spaced versions (American vs. British, Chicago vs. Other Style Guides), etc., etc. Last edited by Tex2002ans; 10-18-2023 at 03:06 PM. |
||||
10-27-2023, 07:23 AM | #14 | |
Member
Posts: 17
Karma: 10
Join Date: Jan 2021
Device: Kobo Forma
|
Quote:
But you are right that the 4th option certainly comes closest, and would at least work in those cases where there are already spaces in place |
|
10-27-2023, 08:16 AM | #15 | |
Wizard
Posts: 2,304
Karma: 12587727
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Regex #1: SPACE + 2 HYPHENS + SPACE -> EN DASH
Regex #2: LETTER + 2 HYPHENS + LETTER -> EM DASH
That would take your examples: Code:
...text -- text... ...text--text... Code:
...text – text... ...text—text... Side Note: In Sigil, I make heavy use of the "Saved Searches" feature in:
You can even use "Groups" to run batches of search/replaces in 1 button press. See: This allows you to save your common search/replaces, and easily run them in the future on any books. You can do similar in Calibre's Editor, except it's in a slightly different location:
|
|
Tags |
dashes, edit, polish, polishing, smarten punctuation |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Smarten Punctuation | hiteshp | Calibre | 4 | 06-13-2021 03:15 AM |
Smarten punctuation | crutledge | Editor | 7 | 04-26-2014 03:02 AM |
Smarten punctuation only? | Psymon | Conversion | 3 | 10-20-2013 10:28 AM |
Simpler Way to Smarten Punctuation | Rand Brittain | Calibre | 3 | 10-10-2010 09:16 PM |
Thanks for new 'Smarten Punctuation' feature | jackie_w | Calibre | 1 | 09-21-2010 03:53 PM |