11
$\begingroup$

I have some Mathematica notebooks that have text, code, plots, and hyperlinks in some text cells. The notebooks use a custom stylesheet that I've used for a number of years. Up until version 11.3 saving my notebooks as PDFs have not been a problem. However, now when I export to PDF everything is in bold font. Is there some command, setting, stylesheet entry that I can change to get it to export as before?

EDIT: I'm using an iMac. Mojave is the OS version. When I change my stylesheet to the default stylesheet it exports to PDF just fine. There are no bold fonts.

$\endgroup$
  • 2
    $\begingroup$ What operating system are you on? This happened for me, not with 11.3 specifically, but with 11.3 on Mojave. 11.3 on High Sierra was fine. $\endgroup$ – user6014 Oct 9 '18 at 19:48
  • 2
    $\begingroup$ @user6014: Same for me. Using High Sierra it was fine but using Mojave it isn't. When I change the stylesheet to the default stylesheet I can export to PDF without it being in bold font. $\endgroup$ – sykh Oct 10 '18 at 0:16
  • 1
    $\begingroup$ Report it to Wolfram then. We may be able to find a workaround here, but we can't fix the issue. $\endgroup$ – user6014 Oct 10 '18 at 0:17
  • 1
    $\begingroup$ I have the same issue and I really don't know how to deal with it ? I tried what sykh did and I had exactly the same . The police is bold in the whole document once you changed the style ... Anyone has an answer today ? I really need help. $\endgroup$ – hypatie Oct 21 '18 at 10:24
  • 2
    $\begingroup$ Possible duplicate of PDF export on macOS Mojave produces bold fonts $\endgroup$ – Szabolcs Nov 21 '18 at 11:19
6
$\begingroup$

The problem is with Mathematica 11.3 or Mac OSX Mojave. After much experimenting I've figured out that if the font is changed from "Source Sans Pro" to anything else then saving the file as PDF leads to bold fonts.

$\endgroup$
  • $\begingroup$ How are you changing the font? $\endgroup$ – Carl Woll Oct 12 '18 at 16:28
  • 1
    $\begingroup$ I open up my notebook and choose "Edit Stylesheet" in the Format menu item. Then go to, say, the local definition for style "Text". Then use the options inspector to change the font type. I've noticed that the style definition for "Text/Printout" is possibly a problem. I can't edit the font for that style. It's stuck at "Source Sans Pro". I think Wolfram has messed up somewhere with stylesheet changes in 11.3. I've noticed that for Input/Printout style I can edit the font and change it and export to PDF isn't in bold font then. $\endgroup$ – sykh Oct 12 '18 at 17:23
  • $\begingroup$ @Carl Woll: I've started tinkering again with the stylesheet and see that I can now change the font for "Text/Printout" but if I change to anything other than "Source Sans Pro" then export to PDF is bold. My font changes to "Output/Printout" are fine and don't cause a problem. $\endgroup$ – sykh Oct 12 '18 at 17:42
  • $\begingroup$ The best thing to do is to provide the stylesheet that has the problem (e.g., CurrentValue[EvaluationNotebook[], StyleDefinitions]). Have you ever modified the default stylesheet? Also, what does: CurrentValue[ EvaluationNotebook[], {StyleDefinitions, {"Text", "Printout"}, FontWeight}] return? $\endgroup$ – Carl Woll Oct 12 '18 at 17:58
  • $\begingroup$ I've never modified the default style sheet. I just opened up a new notebook. Copied the local definition entry for style "Text" from default.nb. Copied into the edit stylesheet window. Went to "Text/Printout" and changed the font to something other than "Source Sans Pro". Executed the command that you asked me to execute and it output "plain". I exported the file to PDF and text in the Text cell was bold. I changed the font back to "Source Sans Pro" and executed the command you mentioned and it came back as "plain". Exported file to PDF and text in Text cell was no longer bold. $\endgroup$ – sykh Oct 12 '18 at 18:38
1
$\begingroup$

(Too long for a comment)

You're not providing enough details for me to reproduce the issue. First, create a small notebook that exhibits the issue (i.e., a notebook with a single text cell, and the problematic stylesheet). Include that in your problem description:

NotebookGet[EvaluationNotebook[]]

will do this. Next, explain what you do to export to pdf. Do you use the File | Save As menu? Or do you use the File | Save Selection As menu? Or do you use Export?

Finally, here is a small notebook with a non-default Text/Printout font:

NotebookPut @ Notebook[
    {
    Cell["This is a text cell","Text"]
    },
    StyleDefinitions -> Notebook[
        {
        Cell[StyleData[StyleDefinitions->"Default.nb"]],
        Cell[StyleData["Text","Printout"],FontFamily->"Courier"]
        },
        StyleDefinitions->"PrivateStylesheetFormatting.nb"
    ]
];

What happens when you save this notebook to PDF?

Addendum

I believe this is what the "Save As" dialog does:

NotebookPrint[
    Notebook[
        {Cell[TextData[{"This text is ",StyleBox["bold", Bold]}], "Text"]},
        StyleDefinitions->Notebook[
            {
            Cell[StyleData[StyleDefinitions->"Default.nb"]],
            Cell[StyleData["Text","Printout"],FontFamily->"Times"]
            },
            StyleDefinitions->"PrivateStylesheetFormatting.nb"
        ]
    ],
    FileNameJoin[{$UserDocumentsDirectory,"pdftest.pdf"}]
]

What does the resulting pdf look like?

Addendum 2

One last thing to check. What do you get for:

Date/.FileInformation[FileNameJoin[{$TopDirectory,"SystemFiles","FrontEnd","StyleSheets","Core.nb"}]]

Date/.FileInformation[FileNameJoin[{$TopDirectory,"SystemFiles","FrontEnd","StyleSheets","Default.nb"}]]

Date/.FileInformation[FileNameJoin[{$LaunchDirectory,"Mathematica"}]]

Also, what happens if you put in an explicit font weight option?

NotebookPrint[
    Notebook[
        {Cell[TextData[{"This text is ",StyleBox["bold", Bold]}], "Text"]},
        StyleDefinitions->Notebook[
            {
            Cell[StyleData[StyleDefinitions->"Default.nb"]],
            Cell[StyleData["Text","Printout"],FontFamily->"Times", FontWeight->Plain]
            },
            StyleDefinitions->"PrivateStylesheetFormatting.nb"
        ]
    ],
    FileNameJoin[{$UserDocumentsDirectory,"pdftest.pdf"}]
]
$\endgroup$
  • $\begingroup$ I don't know how to upload a file to be shared. The definitions for the stylesheet are quite long and it would be just a huge wall of text. In my last comment I mentioned what I did and I think it was specific enough to be able to duplicate if this is an error than is duplicable on another system. I did run the NotebookPut command you mentioned. Created a single text cell with text and used "File -> Save As" to export to PDF. The text was bold. When I changed Courier to Source Sans Pro it was not bold when I saved as PDF. There is no menu Export command on Mac OSX version of 11.3. $\endgroup$ – sykh Oct 12 '18 at 19:43
  • $\begingroup$ @sykh See additional request $\endgroup$ – Carl Woll Oct 12 '18 at 22:12
  • 1
    $\begingroup$ The file printed the text in bold. All of the text. Even the "This text is " part. $\endgroup$ – sykh Oct 13 '18 at 2:07
  • 2
    $\begingroup$ @sykh One final request. If the default and core stylesheets are unchanged, then this may be a Mojave issue, which you should report to support. $\endgroup$ – Carl Woll Oct 13 '18 at 2:44
0
$\begingroup$

I found a temporary solution! Instead of exporting the graphics as pdf just select the plot, then click file, next click print selection, and in the bottom left corner choose save as PDF. It works for me :)

$\endgroup$
0
$\begingroup$

One solution is to change your font to bold and then when you export it will be non-bold! You can select all the relevant cells and the press COMMAND-b to do this. The only problem is that this problem does not occur for Greek font so you need to only change the non-Greek font to bold. I admit this is not very satisfactory as it is quite time-consuming and will need to be undone once the bug is fixed.

Here is an example notebook where this trick worked ( Ithink the FontColor commands should be removed as their colors have not copied over correctly):

Notebook[{Cell[CellGroupData[{Cell[TextData[StyleBox[test ,FontColor->]],Title,CellGroupingRules->{GroupTogetherGrouping,10000.},CellChangeTimes->{{3.63426*10^9,3.63426*10^9},3.63426*10^9,{3.64279*10^9,3.64279*10^9},{3.69655*10^9,3.69655*10^9},{3.72834*10^9,3.72834*10^9},{3.75287*10^9,3.75287*10^9}},FontFamily->Helvetica Neue],Cell[TextData[StyleBox[This is a test.,FontFamily->Helvetica Neue,FontSize->36]],Item2,CellGroupingRules->{GroupTogetherGrouping,10000.},CellChangeTimes->{{3.63614*10^9,3.63614*10^9},{3.66655*10^9,3.66655*10^9},{3.66716*10^9,3.66716*10^9},3.68332*10^9,{3.72834*10^9,3.72834*10^9},{3.72834*10^9,3.72834*10^9},{3.72835*10^9,3.72835*10^9},{3.72835*10^9,3.72835*10^9},{3.75287*10^9,3.75287*10^9}}]},Open]],Cell[BoxData[RowBox[{NotebookGet,[,RowBox[{EvaluationNotebook,[,]}],]}]],Input,CellChangeTimes->{{3.75287*10^9,3.75287*10^9}}]},NotebookAutoSave->True,WindowToolbars->EditBar,WindowSize->{993,929},WindowMargins->{{128,Automatic},{Automatic,120}},PrintingCopies->1,PrintingPageRange->{1,Automatic},PrintingOptions->{Magnification->0.55,PaperOrientation->Landscape,PaperSize->{1530.91,1081.82}},Magnification:>0.75 Inherited,FrontEndVersion->11.1 for Mac OS X x86 (32-bit, 64-bit Kernel) (April 27, 2017),StyleDefinitions->Notebook[{Cell[StyleData[StyleDefinitions->Default.nb]],Cell[StyleData[Text],FontFamily->Helvetica Neue,FontSize->36,FontWeight->Regular,FontSlant->Plain,PrivateFontOptions->{FontPostScriptName->Automatic}],Cell[StyleData[DisplayFormulaNumbered],TextAlignment->Center,FontFamily->Helvetica Neue,FontSize->36,FontWeight->Regular,FontSlant->Plain,PrivateFontOptions->{FontPostScriptName->Automatic}],Cell[StyleData[Subsection],FontFamily->Helvetica Neue,FontSize->40,FontWeight->Regular,FontSlant->Plain,PrivateFontOptions->{FontPostScriptName->Automatic}],Cell[StyleData[Section],FontFamily->Gill Sans,FontSize->48,FontWeight->Regular,FontSlant->Plain,PrivateFontOptions->{FontPostScriptName->Automatic}],Cell[StyleData[DisplayFormula],TextAlignment->Center,FontFamily->Helvetica Neue,FontSize->36,FontWeight->Regular,FontSlant->Plain,PrivateFontOptions->{FontPostScriptName->Automatic}],Cell[StyleData[Subsubsection],FontFamily->Helvetica Neue,FontSize->36,FontWeight->Regular,FontSlant->Italic,PrivateFontOptions->{FontPostScriptName->Automatic},FontColor->],Cell[StyleData[ItemNumbered],FontFamily->Helvetica Neue,FontSize->36,FontWeight->Regular,PrivateFontOptions->{FontPostScriptName->Automatic},FontColor->],Cell[StyleData[Subsubsection],FontFamily->Gill Sans,FontSize->36,FontWeight->Regular,FontSlant->Plain,PrivateFontOptions->{FontPostScriptName->Automatic}]},Visible->False,FrontEndVersion->11.1 for Mac OS X x86 (32-bit, 64-bit Kernel) (April 27, 2017),StyleDefinitions->PrivateStylesheetFormatting.nb]]
$\endgroup$
  • $\begingroup$ This does not work for me. Can you give an example? $\endgroup$ – b3m2a1 Dec 3 '18 at 9:34
  • $\begingroup$ Done, see the modified answer. If you change the text to bold then save as pdf it will be non-bold. $\endgroup$ – Virgo Dec 4 '18 at 0:41
  • $\begingroup$ I think you didn't copy the right expression. You're missing the " marks that I would expect (and that are needed for it to be a valid expression). $\endgroup$ – b3m2a1 Dec 4 '18 at 2:12
  • $\begingroup$ I emailed it to you. $\endgroup$ – Virgo Dec 4 '18 at 7:40
  • $\begingroup$ I'm afraid it still does not work for me. Perhaps there are some more subtle dependencies too. $\endgroup$ – b3m2a1 Dec 4 '18 at 7:49
0
$\begingroup$

I reported the bug to Mathematica (this is also a problem with EPS). Here is their answer:

It does appear that Export is not behaving properly with EPS or PDF formats. I have forwarded an issue report to our developers with the information you provided, and included your contact information in my report.

As a workaround, instead of Exporting the graphics as a PDF, save the graphic as a PDF from the Print dialog. To do so:

  1. Create your graphic in the notebook
  2. Select the graphic, go to File -> Print Selection, and from the lower left of the dialog, select "Save as PDF"
  3. Use the Save dialog to save the created PDF somewhere on your computer.

We are always interested in improving Mathematica, and I want to thank you once again for bringing this issue to our attention. If you run into any other problems, or have any additional questions, please feel free to contact us.

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.