Nathan,

This is great, definitely a step forward although still not 100% what was 
hoping for.
I replicated what you write and same results here with Times and Helvetica as 
the default. I then also tried

pbpaste | pandoc -f bibtex -t rtf -C --csl=apa.csl --template=no-font.rtf 
--standalone | pbcopy

thinking that obviously when opening the rtf it needs to display it in some 
font, using some default, but perhaps when storing in the clipboard directly it 
doesn’t have that information.
However, when then pasting it into Word it still pastes it as Times New Roman 
(when “keep source formatting” is selected) – even if the document font is a 
different one.
And pasting it into any of Apple’s text programs (TextEdit, Mail, ...) it 
always gives me Helvetica.

So my hunch is that at some point prior to pasting the clipboard contents the 
respective program adds font information back to the contents received from 
clipboard – and in Microsoft’s case that continues to be Times New Roman (some 
legacy reason perhaps, since they no longer use Times as their default document 
font). In Apple’s case it’s Helvetica. That’s the only way I can explain the 
difference in font between Apple and Microsoft.
Seems there may not be a way around this. Even if it’s stored in clipboard with 
the font still “nil”, if the respective programs add that info back prior to 
pasting no approach is going to be able to solve that :(
I much appreciate your help though, figuring this out … definitely learned a 
lot!

Jan

> On Sep 15, 2024, at 3:55 PM, Nathan <[email protected]> wrote:
>
> Jan:
>
> Pandoc has a default RTF template that it 
> uses:https://github.com/jgm/pandoc-templates/blob/master/default.rtf
>
> The font in Pandoc's default template is Helvetica, as you can see in its 
> first line:
>
> {\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 \fmodern Courier;}}
>
> I have just learned 
> fromhttps://latex2rtf.sourceforge.net/rtfspec_6.html#rtfspec_10that there is 
> a way to specify an "Unknown or default font" using \fnil in RTF, which would 
> look like this when modifying the previous line from Pandoc's template:
>
> {\rtf1\ansi\deff0{\fonttbl{\f0 \fnil;}{\f1 \fnil;}}
>
> I modified Pandoc's default RTF template using the previous line, saved it as 
> ~/.pandoc/templates/no-font.rtf, and used it to generate an RTF file from 
> BibTeX on the clipboard with the following command:
>
> pbpaste | pandoc -f bibtex -t rtf -C --csl=apa.csl --template=no-font.rtf -o 
> Desktop/references.rtf
>
> If I open the resulting references.rtf file in Microsoft Word, it displays 
> using Word's default font, Times New Roman. However, if I open the file in 
> QuickLook or in TextEdit, it displays using Helvetica. It may be that 
> Helvetica is the macOS default font for rich text.
>
> You could create an RTF export template for BibDesk using \fnil as the font, 
> but it seems that \fnil will always be interpreted as Helvetica in standard 
> macOS rich text.
>
> I found the following blog post by Andrew Heiss that describes how he uses an 
> Automator action to convert Markdown in any macOS app to rich text using 
> Pandoc:https://www.andrewheiss.com/blog/2019/10/09/convert-md-rtf-macos-services/
>
> Heiss's method would be be another option: use a Markdown (plain-text) export 
> template in BibDesk, and use an Automator action after you paste the text to 
> convert the Markdown to rich text. But I don't see how this would be a better 
> solution than an RTF export template in BibDesk. Heiss developed his solution 
> because he wants syntax highlighting for his programming-language code 
> blocks, which Pandoc provides.
>
> Nathan
>
>> On Sep 15, 2024, at 4:55 PM, Christiaan Hofman <[email protected]> wrote:
>>
>> There will always be some formatting, like the font. It generates rich 
>> text.There does not exist rich text with *only* an italic attribute, that 
>> does not exist (does not make sense), as italic is a part of the font 
>> information. There is always the font, at minimum.
>>
>> As for Nathan’s suggestion, that goes outside BiBDesk. And it will also 
>> generate rich text, so it will also contain at least font attributes.
>>
>> Christiaan
>>
>>> On 15 Sep 2024, at 21:02, Jan David Hauck via Bibdesk-users 
>>> <[email protected]> wrote:
>>>
>>> I’m sorry, I still don’t understand how I would add a key to the key path 
>>> to remove the formatting?
>>> From the list here 
>>> https://bibdesk.sourceforge.io/manual/BibDeskHelp_95.html I couldn’t see 
>>> anything that would do that.
>>>
>>> I tried Nathan’s suggestions, but yes, as you said, it still has font 
>>> information preserved (it pastes it as Helvetica, not exactly sure where it 
>>> gets that from if it is not using any template).
>>>
>>> Thanks,
>>>
>>> Jan
>
> _______________________________________________
> Bibdesk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bibdesk-users
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to