* How to remove the spaces around citations for CJK document when converted into pdf
@ 2019-04-19 14:48 jiewuza
[not found] ` <m2mukm8314.fsf-9Onoh4P/yGk@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: jiewuza @ 2019-04-19 14:48 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
For example, in my test.md (here XXX stands for CJK text)
```
XXXXX @some-bibkey XXXXX
```
pandoc would convert it into tex like
```
XXXXX \textcite{some-bibkey} XXXXX
```
Note the spaces around `\textcite{some-bibkey}`, which would be
preserved in the final pdf, like
```
XXXXX XXX XXXXX
```
However, for CJK document convention, those spaces are not wanted.
If I removed the spaces in my test.md as
```
XXXXX@some-bibkeyXXXXX
```
The citation is not recognized at all.
I have no idea how to make it in a lua filter.
Or should I resort to any other external tools to do it?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to remove the spaces around citations for CJK document when converted into pdf
[not found] ` <m2mukm8314.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2019-04-19 17:52 ` John MacFarlane
2019-04-20 12:36 ` jiewuza
2019-04-21 13:23 ` jiewuza
0 siblings, 2 replies; 6+ messages in thread
From: John MacFarlane @ 2019-04-19 17:52 UTC (permalink / raw)
To: jiewuza, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
first suggestion would be to use this form of citation
XXX[@cite]XXX
Then spaces aren't required.
Second suggestion would be to use a lua filter to
strip spaces. That's easy enough.
-- nospace.lua
function Space(el)
return {}
end
This will strip all regular textual spaces in the
document (keeping soft breaks and spaces in code).
jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> For example, in my test.md (here XXX stands for CJK text)
> ```
> XXXXX @some-bibkey XXXXX
> ```
>
> pandoc would convert it into tex like
> ```
> XXXXX \textcite{some-bibkey} XXXXX
> ```
>
> Note the spaces around `\textcite{some-bibkey}`, which would be
> preserved in the final pdf, like
> ```
> XXXXX XXX XXXXX
> ```
>
> However, for CJK document convention, those spaces are not wanted.
>
> If I removed the spaces in my test.md as
> ```
> XXXXX@some-bibkeyXXXXX
> ```
> The citation is not recognized at all.
>
> I have no idea how to make it in a lua filter.
>
> Or should I resort to any other external tools to do it?
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2mukm8314.fsf%40163.com.
> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to remove the spaces around citations for CJK document when converted into pdf
2019-04-19 17:52 ` John MacFarlane
@ 2019-04-20 12:36 ` jiewuza
2019-04-21 13:23 ` jiewuza
1 sibling, 0 replies; 6+ messages in thread
From: jiewuza @ 2019-04-20 12:36 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> first suggestion would be to use this form of citation
>
> XXX[@cite]XXX
>
> Then spaces aren't required.
>
Well, `[@cite]` is converted to `autocite` and `@cite` to `textcite`.
At first I set `autocite` to `supercite` (author not mentioned in the
citation).
In my example, I want to show the author, so I used `@cite` instead of `[@cite]`.
Thank you for your suggestion.
I will learn and try to customize my biblatex settings to make it work.
> Second suggestion would be to use a lua filter to
> strip spaces. That's easy enough.
>
> -- nospace.lua
> function Space(el)
> return {}
> end
>
> This will strip all regular textual spaces in the
> document (keeping soft breaks and spaces in code).
>
In my real document, it is possible to have CJK and English text mixed
together. I guess this `nospace` lua filter will do damage to English
text.
> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>
>> For example, in my test.md (here XXX stands for CJK text)
>> ```
>> XXXXX @some-bibkey XXXXX
>> ```
>>
>> pandoc would convert it into tex like
>> ```
>> XXXXX \textcite{some-bibkey} XXXXX
>> ```
>>
>> Note the spaces around `\textcite{some-bibkey}`, which would be
>> preserved in the final pdf, like
>> ```
>> XXXXX XXX XXXXX
>> ```
>>
>> However, for CJK document convention, those spaces are not wanted.
>>
>> If I removed the spaces in my test.md as
>> ```
>> XXXXX@some-bibkeyXXXXX
>> ```
>> The citation is not recognized at all.
>>
>> I have no idea how to make it in a lua filter.
>>
>> Or should I resort to any other external tools to do it?
>>
>> --
>> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to
>> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/m2mukm8314.fsf%40163.com.
>> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to remove the spaces around citations for CJK document when converted into pdf
2019-04-19 17:52 ` John MacFarlane
2019-04-20 12:36 ` jiewuza
@ 2019-04-21 13:23 ` jiewuza
[not found] ` <m2bm0z8pbo.fsf-9Onoh4P/yGk@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: jiewuza @ 2019-04-21 13:23 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> first suggestion would be to use this form of citation
>
> XXX[@cite]XXX
>
> Then spaces aren't required.
>
Well, `[@cite]` is converted to `\autocite` and `@cite` to `\textcite`
in tex (using biblatex). At first I set `\autocite` to `\supercite`. So
when I want to supercite a citation, I use `[@cite]` (which shows a
superscript number in the final pdf), and when I want to textcite a
citation, I use `@cite` instead (which shows the author in the final
pdf). This toggles citation style conveniently.
In my example, I want to show the author, so I used `@cite`.
Your suggestion is helpful. It solves the spaces-problem.
But I also want to keep the toggle-mechanism.
Fortunately, I read in the document `A minus sign (-) before the @ will
suppress mention of the author in the citation.`
However, I find that `[-@cite]` is converted to `\autocite*` in tex.
I cannot configure `\autocite` and `\autocite*` to different commands in
biblatex, so that I can make one show a superscript number while another
show the author.
> Second suggestion would be to use a lua filter to
> strip spaces. That's easy enough.
>
> -- nospace.lua
> function Space(el)
> return {}
> end
>
> This will strip all regular textual spaces in the
> document (keeping soft breaks and spaces in code).
>
In my real document, it is possible to have CJK and English text mixed
together. I guess this `nospace` lua filter will do damage to English
text.
> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>
>> For example, in my test.md (here XXX stands for CJK text)
>> ```
>> XXXXX @some-bibkey XXXXX
>> ```
>>
>> pandoc would convert it into tex like
>> ```
>> XXXXX \textcite{some-bibkey} XXXXX
>> ```
>>
>> Note the spaces around `\textcite{some-bibkey}`, which would be
>> preserved in the final pdf, like
>> ```
>> XXXXX XXX XXXXX
>> ```
>>
>> However, for CJK document convention, those spaces are not wanted.
>>
>> If I removed the spaces in my test.md as
>> ```
>> XXXXX@some-bibkeyXXXXX
>> ```
>> The citation is not recognized at all.
>>
>> I have no idea how to make it in a lua filter.
>>
>> Or should I resort to any other external tools to do it?
>>
>> --
>> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to
>> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/m2mukm8314.fsf%40163.com.
>> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to remove the spaces around citations for CJK document when converted into pdf
[not found] ` <m2bm0z8pbo.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2019-04-23 18:40 ` BPJ
2019-04-24 15:16 ` jiewuza
0 siblings, 1 reply; 6+ messages in thread
From: BPJ @ 2019-04-23 18:40 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 4314 bytes --]
Maybe you can cheat by using ​ zero width space which if I am not
mistaken is meant exactly for situations like this.
Den tis 23 apr. 2019 18:14jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
> > first suggestion would be to use this form of citation
> >
> > XXX[@cite]XXX
> >
> > Then spaces aren't required.
> >
> Well, `[@cite]` is converted to `\autocite` and `@cite` to `\textcite`
> in tex (using biblatex). At first I set `\autocite` to `\supercite`. So
> when I want to supercite a citation, I use `[@cite]` (which shows a
> superscript number in the final pdf), and when I want to textcite a
> citation, I use `@cite` instead (which shows the author in the final
> pdf). This toggles citation style conveniently.
>
> In my example, I want to show the author, so I used `@cite`.
>
> Your suggestion is helpful. It solves the spaces-problem.
> But I also want to keep the toggle-mechanism.
> Fortunately, I read in the document `A minus sign (-) before the @ will
> suppress mention of the author in the citation.`
>
> However, I find that `[-@cite]` is converted to `\autocite*` in tex.
> I cannot configure `\autocite` and `\autocite*` to different commands in
> biblatex, so that I can make one show a superscript number while another
> show the author.
>
>
> > Second suggestion would be to use a lua filter to
> > strip spaces. That's easy enough.
> >
> > -- nospace.lua
> > function Space(el)
> > return {}
> > end
> >
> > This will strip all regular textual spaces in the
> > document (keeping soft breaks and spaces in code).
> >
>
> In my real document, it is possible to have CJK and English text mixed
> together. I guess this `nospace` lua filter will do damage to English
> text.
>
> > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> >
> >> For example, in my test.md (here XXX stands for CJK text)
> >> ```
> >> XXXXX @some-bibkey XXXXX
> >> ```
> >>
> >> pandoc would convert it into tex like
> >> ```
> >> XXXXX \textcite{some-bibkey} XXXXX
> >> ```
> >>
> >> Note the spaces around `\textcite{some-bibkey}`, which would be
> >> preserved in the final pdf, like
> >> ```
> >> XXXXX XXX XXXXX
> >> ```
> >>
> >> However, for CJK document convention, those spaces are not wanted.
> >>
> >> If I removed the spaces in my test.md as
> >> ```
> >> XXXXX@some-bibkeyXXXXX
> >> ```
> >> The citation is not recognized at all.
> >>
> >> I have no idea how to make it in a lua filter.
> >>
> >> Or should I resort to any other external tools to do it?
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to
> >> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/pandoc-discuss/m2mukm8314.fsf%40163.com.
> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/m2bm0z8pbo.fsf%40163.com.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBLEuqK%2BBi5X1J-sp28Np3TO7sRqmpaFN_A3y5HDEHFxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #2: Type: text/html, Size: 6524 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to remove the spaces around citations for CJK document when converted into pdf
2019-04-23 18:40 ` BPJ
@ 2019-04-24 15:16 ` jiewuza
0 siblings, 0 replies; 6+ messages in thread
From: jiewuza @ 2019-04-24 15:16 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Thanks.
Never thought of zero width space.
I will give it a shot.
BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> Maybe you can cheat by using ​ zero width space which if I am not mistaken is meant exactly for situations like this.
>
> Den tis 23 apr. 2019 18:14jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>
> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
> > first suggestion would be to use this form of citation
> >
> > XXX[@cite]XXX
> >
> > Then spaces aren't required.
> >
> Well, `[@cite]` is converted to `\autocite` and `@cite` to `\textcite`
> in tex (using biblatex). At first I set `\autocite` to `\supercite`. So
> when I want to supercite a citation, I use `[@cite]` (which shows a
> superscript number in the final pdf), and when I want to textcite a
> citation, I use `@cite` instead (which shows the author in the final
> pdf). This toggles citation style conveniently.
>
> In my example, I want to show the author, so I used `@cite`.
>
> Your suggestion is helpful. It solves the spaces-problem.
> But I also want to keep the toggle-mechanism.
> Fortunately, I read in the document `A minus sign (-) before the @ will
> suppress mention of the author in the citation.`
>
> However, I find that `[-@cite]` is converted to `\autocite*` in tex.
> I cannot configure `\autocite` and `\autocite*` to different commands in
> biblatex, so that I can make one show a superscript number while another
> show the author.
>
> > Second suggestion would be to use a lua filter to
> > strip spaces. That's easy enough.
> >
> > -- nospace.lua
> > function Space(el)
> > return {}
> > end
> >
> > This will strip all regular textual spaces in the
> > document (keeping soft breaks and spaces in code).
> >
>
> In my real document, it is possible to have CJK and English text mixed
> together. I guess this `nospace` lua filter will do damage to English
> text.
>
> > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> >
> >> For example, in my test.md (here XXX stands for CJK text)
> >> ```
> >> XXXXX @some-bibkey XXXXX
> >> ```
> >>
> >> pandoc would convert it into tex like
> >> ```
> >> XXXXX \textcite{some-bibkey} XXXXX
> >> ```
> >>
> >> Note the spaces around `\textcite{some-bibkey}`, which would be
> >> preserved in the final pdf, like
> >> ```
> >> XXXXX XXX XXXXX
> >> ```
> >>
> >> However, for CJK document convention, those spaces are not wanted.
> >>
> >> If I removed the spaces in my test.md as
> >> ```
> >> XXXXX@some-bibkeyXXXXX
> >> ```
> >> The citation is not recognized at all.
> >>
> >> I have no idea how to make it in a lua filter.
> >>
> >> Or should I resort to any other external tools to do it?
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an
> >> email to
> >> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msgid/pandoc-discuss/m2mukm8314.fsf%40163.com.
> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2bm0z8pbo.fsf%40163.com.
> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-04-24 15:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-19 14:48 How to remove the spaces around citations for CJK document when converted into pdf jiewuza
[not found] ` <m2mukm8314.fsf-9Onoh4P/yGk@public.gmane.org>
2019-04-19 17:52 ` John MacFarlane
2019-04-20 12:36 ` jiewuza
2019-04-21 13:23 ` jiewuza
[not found] ` <m2bm0z8pbo.fsf-9Onoh4P/yGk@public.gmane.org>
2019-04-23 18:40 ` BPJ
2019-04-24 15:16 ` jiewuza
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).