* Quotation dash issues with semantic markup @ 2019-12-30 4:03 Sam May 2019-12-30 9:19 ` Hans Hagen 0 siblings, 1 reply; 4+ messages in thread From: Sam May @ 2019-12-30 4:03 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1.1: exmp-dialogue.txt --] [-- Type: text/plain, Size: 2187 bytes --] Any of you able to help me get my quotation dashes into line when automatically inserted by the semantic commands? I'm sure a number of you look at this style and cringe, but A. I'm not looking for grammatical input, and B. I'm intending this for a non-English language where the quotation dash (though still not most common) isn't as out of place. See attachment for actual examples, but I'm looking for a dash at each side of the quotation, /except/ at the very end of a paragraph. I additionally want dialogue tags (via \aside, and located within quotations) to not print their surrounding decoration if they're directly next to the larger dash of the quotation. Unfortunately, the only way I can think of doing the first is by checking if the next token's \par, and that gets thrown off by the internal logic of \quotation; I'm not at all sure how to start going about the asides. It would also be nice if a quote ending in a period carried the 'broad' spacing to the other side of the (ending) quote dash -- the dash before 'Also' in the examples would be packed on the left and broad on the right. I know this might be a lot trickier to code, and only consider it a bonus. An additional issue with \removeunwantedspaces only seems to affect the command forms. When inserted directly, the spacing acts as desired in the PDF (as expected, the XML doesn't understand the order). Also, the right |>| doesn't require either of the explicit spacing instructions (beyond being non-breaking) while the others do. The quotation dash itself only /looks/ as I want it; when I highlight and copy the text or export it to the XML backend, it's still two dashes next to each other. Instead, I'd like it to be the Unicode bar U+2015. I'm not sure if TEX/LUATEX allows that difference between appearance and interaction (I do know PDF does), so if there's some way of adding a new glyph to the font -- one that mimics the other dashes even if the font changes -- I'd love to actually use the proper codepoint. As is, that doesn't work in the standard font(s). Thanks for the help! I know it's quite a bit of an ask. Sam [-- Attachment #1.1.2: exmp-dialogue.tex --] [-- Type: application/x-tex, Size: 3011 bytes --] [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Quotation dash issues with semantic markup 2019-12-30 4:03 Quotation dash issues with semantic markup Sam May @ 2019-12-30 9:19 ` Hans Hagen 2020-01-17 19:11 ` Wolfgang Schuster 0 siblings, 1 reply; 4+ messages in thread From: Hans Hagen @ 2019-12-30 9:19 UTC (permalink / raw) To: mailing list for ConTeXt users, Sam May On 12/30/2019 5:03 AM, Sam May wrote: \setuplanguage[en] [leftquotation=\quotedash~, rightquotation=~\quotedash, leftsentence=\removeunwantedspaces~\endash\space, midsentence=\removeunwantedspaces~\endash\space, % leftsentence=\endash~, % midsentence=~\endash, rightsentence=~\endash] \define\quotedash{\emdash\endash} %\setupbackend[export=yes] \starttext \startsection[title=Introduction] Any of you able to help me get my quotation dashes into line when automatically inserted by the semantic commands? I'm sure a number of you look at this style and cringe, but \cap{A.} I'm not looking for grammatical input, and \cap{B.} I'm intending this for a non-English language where the quotation dash (though still not most common) isn't as out of place. \stopsection \startsection[title=Desired rendering] \quotedash~Speech should always have a dash at the start, but none at the end of a paragraph. \quotedash~Dialog asides should not duplicate dashes,~\endash\ he said.~\quotedash\ Also, this doesn't reflect the spacing mentioned in section \in[extra]. \quotedash~nor, as above, add ones at the end of paragraphs. \endash~he continued. \stopsection \startsection[title=Actual output] \speech{Speech should always have a dash at the start, but none at the end of a paragraph.} \speech{Dialog asides should not duplicate dashes, \aside{he said.}} Also, note the spacing isn't removed despite \type{\removeunwantedspaces}, but instead duplicated. \speech{nor, as above, add ones at the end of paragraphs. \aside{he continued.}} \stopsection \startsection[title=Additional considerations and observations,reference=extra] It would also be nice if a quote ending in a period carried the \quote{broad} spacing to the other side of the (ending) quote dash |=| the dash before \quote{Also} above would be packed on the left and broad on the right. I know this might be a lot trickier to code, and only consider it a bonus. The issue with \type{\removeunwantedspaces} only seems to affect the command forms. When inserted directly |<| as here |>| the spacing acts as desired in the \cap{PDF} (as expected, the \cap{XML} doesn't understand the order). Also, the right \type{|>|} doesn't require either of the explicit spacing instructions (beyond being non-breaking) while the others do; try switching the commented lines and re-rendering. The quotation dash itself only \emph{looks} as I want it; when I highlight and copy the text or export it to the \cap{XML} backend, it's still two dashes next to each other. Instead, I'd like it to be the Unicode bar U+2015. I'm not sure if \TEX/\LUATEX\ allows that difference between appearance and interaction (I do know \cap{PDF} does), so if there's some way of adding a new glyph to the font |<| one that mimics the other dashes even if the font changes |>| I'd love to actually use the proper codepoint. As is, that doesn't work in the standard font(s): [\char"2015]. \stopsection \stoptext I bet that Wolfgang has the answers to the speech setup so I'll do the font part. Assuming that you use context lmtx (the luametatex branch), you can use some of the new metafun magic. \startMPcalculation{simplefun} vardef QuotationDash = draw image ( interim linecap := squared ; save l ; l := 0.2 ; draw (l/2,2) -- (15-l/2,2) withpen pencircle scaled l ; ) enddef ; lmt_registerglyphs [ name = "symbols", units = 10, usecolor = true, width = 15, height = 2.1, depth = 0, ] ; lmt_registerglyph [ category = "symbols", unicode = "0x2015", code = "QuotationDash ;" ] ; \stopMPcalculation \definefontfeature[default][default][metapost=symbols] % \showglyphs \starttext \startlines xx\endash xx xx\emdash xx xx\endash\emdash xx xx\char"2015 xx \stoplines \stoptext Keep in mind that when you use for instance pagella, that there already that glyph. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Quotation dash issues with semantic markup 2019-12-30 9:19 ` Hans Hagen @ 2020-01-17 19:11 ` Wolfgang Schuster 2020-01-18 9:30 ` Hans Hagen 0 siblings, 1 reply; 4+ messages in thread From: Wolfgang Schuster @ 2020-01-17 19:11 UTC (permalink / raw) To: mailing list for ConTeXt users Hans Hagen schrieb am 30.12.2019 um 10:19: > On 12/30/2019 5:03 AM, Sam May wrote: > > > \setuplanguage[en] > [leftquotation=\quotedash~, > rightquotation=~\quotedash, > leftsentence=\removeunwantedspaces~\endash\space, > midsentence=\removeunwantedspaces~\endash\space, > % leftsentence=\endash~, > % midsentence=~\endash, > rightsentence=~\endash] > \define\quotedash{\emdash\endash} > > %\setupbackend[export=yes] > > \starttext > > \startsection[title=Introduction] > Any of you able to help me get my quotation dashes into line when > automatically > inserted by the semantic commands? I'm sure a number of you look at > this style > and cringe, but \cap{A.} I'm not looking for grammatical input, and > \cap{B.} > I'm intending this for a non-English language where the quotation dash > (though > still not most common) isn't as out of place. > \stopsection > > \startsection[title=Desired rendering] > \quotedash~Speech should always have a dash at the start, but none at > the end > of a paragraph. > > \quotedash~Dialog asides should not duplicate dashes,~\endash\ he > said.~\quotedash\ Also, this doesn't reflect the spacing mentioned in > section > \in[extra]. \quotedash~nor, as above, add ones at the end of paragraphs. > \endash~he continued. > \stopsection > > \startsection[title=Actual output] > \speech{Speech should always have a dash at the start, but none at the > end of a > paragraph.} > > \speech{Dialog asides should not duplicate dashes, \aside{he said.}} > Also, note > the spacing isn't removed despite \type{\removeunwantedspaces}, but > instead > duplicated. \speech{nor, as above, add ones at the end of paragraphs. > \aside{he continued.}} > \stopsection > > \startsection[title=Additional considerations and > observations,reference=extra] > It would also be nice if a quote ending in a period carried the > \quote{broad} > spacing to the other side of the (ending) quote dash |=| the dash before > \quote{Also} above would be packed on the left and broad on the right. > I know > this might be a lot trickier to code, and only consider it a bonus. > > The issue with \type{\removeunwantedspaces} only seems to affect the > command > forms. When inserted directly |<| as here |>| the spacing acts as > desired in > the \cap{PDF} (as expected, the \cap{XML} doesn't understand the > order). Also, > the right \type{|>|} doesn't require either of the explicit spacing > instructions (beyond being non-breaking) while the others do; try > switching the > commented lines and re-rendering. > > The quotation dash itself only \emph{looks} as I want it; when I > highlight and > copy the text or export it to the \cap{XML} backend, it's still two > dashes next > to each other. Instead, I'd like it to be the Unicode bar U+2015. > I'm not > sure if \TEX/\LUATEX\ allows that difference between appearance and > interaction > (I do know \cap{PDF} does), so if there's some way of adding a new > glyph to the > font |<| one that mimics the other dashes even if the font changes |>| > I'd love > to actually use the proper codepoint. As is, that doesn't work in the > standard > font(s): [\char"2015]. > \stopsection > > \stoptext > > I bet that Wolfgang has the answers to the speech setup so I'll do the > font part. It's possible to use leaders to remove multiple dashes and also dashes at the end of a paragraph but this will only work for the PDF. A limitation is that you can't use the existing \speech and \aside commands because they use groups which prevents the removal of unwanted dashes. \unprotect \def\speech_dash {\setbox\scratchbox\hbox{\texthorizontalbar\space}% \leaders\copy\scratchbox\hskip\wd\scratchbox} \def\speech_left {\ifhmode \removeunwantedspaces \else \dontleavehmode \fi \space\speech_dash} \def\speech_right {\removeunwantedspaces \space\speech_dash} %\define[1]\speech % {\speech_left#1\speech_right} \unexpanded\def\speech {\speech_left \bgroup \aftergroup\speech_right \let\next=} \def\aside_dash {\setbox\scratchbox\hbox{\endash\space}% \leaders\copy\scratchbox\hskip\wd\scratchbox} \def\aside_left {\ifhmode \removeunwantedspaces \else \dontleavehmode \fi \space\aside_dash} \def\aside_right {\space\aside_dash} %\define[1]\aside % {\aside_left#1\aside_right} \unexpanded\def\aside {\aside_left \bgroup \aftergroup\aside_right \let\next=} \protect \setupbodyfont[pagella] \starttext \speech{first speech} \speech{second speech} \speech{first speech} no speech \speech{second speech} \speech{first speech\aside{aside}} \speech{second speech} \speech{speech \aside{aside}} no speech \stoptext Wolfgang ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Quotation dash issues with semantic markup 2020-01-17 19:11 ` Wolfgang Schuster @ 2020-01-18 9:30 ` Hans Hagen 0 siblings, 0 replies; 4+ messages in thread From: Hans Hagen @ 2020-01-18 9:30 UTC (permalink / raw) To: Wolfgang Schuster, mailing list for ConTeXt users On 1/17/2020 8:11 PM, Wolfgang Schuster wrote: > It's possible to use leaders to remove multiple dashes and also dashes > at the end of a paragraph but this will only work for the PDF. A > limitation is that you can't use the existing \speech and \aside > commands because they use groups which prevents the removal of unwanted > dashes. there's another trick that we can use ... i'll send you (ws) something to play with as we (you) might integrate it in the speech handler somehow Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-18 9:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-12-30 4:03 Quotation dash issues with semantic markup Sam May 2019-12-30 9:19 ` Hans Hagen 2020-01-17 19:11 ` Wolfgang Schuster 2020-01-18 9:30 ` Hans Hagen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).