Message Boards Message Boards

0
|
13695 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:
GROUPS:

Export Graphics for Latex

Posted 10 years ago

I have to write scientific article with latex.

I must import some graphics from a Mathematica Notebook. What is the better way to do?

Does anybody know good references with explanations about it?

Thanks

4 Replies

Hi,

is this a Latex or a Mathematica question? If you have a graphic in Mathematica, it is quite straight forward to export to a number of different formats, e.g.

figure=Plot[Sin[x],{x,0,10}];
Export["~/Desktop/SinPlot.jpg",figure]

or

Export["~/Desktop/SinPlot.pdf",figure]

generates files you can embed into Latex documents. It is quite straight forward to google how to embed pdfs into Latex.

Cheers,

Marco

POSTED BY: Marco Thiel

Mikel,

You can also consider selecting the cell in Mathematica and then going to File > Save Selection As or File > Print Selection. In the second one, you can print to a PDF (I have found that this second option is the best way of getting a multiple-page PDF, but you may not need that for your figure). The first option is useful because it provides many other formats.

In LaTeX you can use \includegraphics to put the file in your document. This function is included in the graphix package, if I recall correctly.

OL.

POSTED BY: Otto Linsuain
Posted 10 years ago

Hi,

I produce the graphics using "Export" command as pdf format and I use "\includegraphics" to put the file in my LATEX's document.

funs = {Sin[x], Normal[Sin[x] + O[x]^8]}; g = Plot[Evaluate[funs], {x, 0, 2 Pi}, AxesLabel -> {"x", "Sin"}, PlotLegends -> funs, BaseStyle -> {FontSize -> 10}, Frame -> True] Export[NotebookDirectory[] <> "figure.pdf", Show[g]]

But I don't like the quality of the labels, legends, axes, ... and I have many problems (in the example the axeslabel is no correct,...).

Attachments:

If you have Latin Modern fonts on your system you get a better result with

funs = {Sin[x], Normal[Sin[x] + O[x]^8]}; g = 
 Plot[Evaluate[funs], {x, 0, 2 Pi}, AxesLabel -> {"x", "Sin"}, 
  PlotLegends -> {Style[TraditionalForm[Sin[x]], 
     FontFamily -> "Latin Modern Roman"], 
    Style[Normal[Sin[x] + O[x]^8], 
     FontFamily -> "Latin Modern Roman"]}, 
  BaseStyle -> {FontSize -> 10, FontFamily -> "Latin Modern Roman"}, 
  Frame -> True]

Otherwise try with the Times font family.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract