Tag Info

Hot answers tagged

33

There are a few different parts to your question. I'll just answer the part about using psfragand pdflatex. There's a package called pstool that automates the whole process of using psfrag with pdflatex. For example, here's a graphics created in Mathematica 8 plot = Plot[Sin[Exp[x]], {x, -Pi, Pi}, AxesLabel -> {"e", "s"}] Export[NotebookDirectory[] ...


30

Exporting graphics with consistent font sizes I'll show you my preferred way of exporting figures for use with $\LaTeX$. I prefer to use consistent font sizes in figures. This means that I need to export PDF figures at the final print size and avoid scaling them within LaTeX. (Note that PDF files contain information about the physical print size of the ...


27

This is a good application for the highly underused Splice function which has been in Mathematica since version 1 (I don't recall it ever being used on this site). Create a file called main.mtex with the following text: \documentclass[preview,border=12pt,12pt]{standalone} \usepackage{amsmath} \def\f(#1){(#1)^2-5*(#1)+6} \begin{document} ...


27

Here is my attempt to generate a pseudocode for algorithmicx package. Current features Functions (as SetDelayed) Set If with 2 and 3 arguments While Do (any number of variables of any type) New! Return Module, With, and Block CompoundExpression (;) Test functions (EvenQ, etc., and Not@EvenQ, etc.) New! Indentation Code ClearAll[pseudocode, pscd] ...


22

Here is a Manipulate to design yourself an Arrow: DynamicModule[{top, baseMid, rightBase, outerMidRight, innerMidRight}, Manipulate[ top = {0, 0}; baseMid = {1, 0} baseMid; rightBase = {1, -1} leftBase; outerMidRight = {1, -1} outerMidLeft; innerMidRight = {1, -1} innerMidLeft; h = Graphics[ { Opacity[0.5], FilledCurve[ { ...


21

One source of arrowhead shapes is Graph which comes with a list of predefined arrowhead shapes that you can set using the option EdgeShapeFunction. You can get the names of these shapes by doing something like arrowheadNames = GraphElementData["Edge"]; Unfortunately, these names by themselves are useless in Arrowheads. Luckily there is a way to extract ...


20

I'm prompted by Mathematica when pasting (using 8.0.4) so I don't have this issue. The following seems to do the trick though.. ToExpression["\\frac{1}{2}", TeXForm] I would expect others might have more illuminating responses to this. EDIT: The prompt I referred to is controlled via GlobalOptions > MessageOptions > TeXPasteWarning in the Options ...


19

I'll treat this question as being mainly about annotating graphics using LaTeX syntax. For that purpose, here is a template that you could use: Plot[Sin[x], {x, 0, 2 Pi}, Epilog -> Text[Style[ ToExpression["\\sin\\alpha", TeXForm, HoldForm], Large], {Pi, .5}]] However, there are several caveats because the ability of Mathematica to interpret ...


17

An example of large publication project developed in Mathematica is CDF calculus book published by Pearson. Go to this link to look at a sample: Anotated Full screen The author of CDF part of the book, Eric Schulz, gave a talk "Publishing a CDF ebook: an Author's Perspective" where he explains approaches to large publishing projects: typesetting, custom ...


16

I would like to make my graphics homogeneous with my (LaTeX) document. That means that I would like to use the same font in the graphics (labels for axis etc) as the main text. I recently wrote a package, called MaTeX, to solve this exact problem. MaTeX makes it easy to compile short LaTeX snippets and embed them in Mathematica notebooks or graphics. ...


13

Probably the easiest solution here is to use Format[x[arg_],TraditionalForm]:=Subscript[x, arg] This makes sure that the subscript form is used when the display is in TraditionalForm, which is also an intermediate step in creating TeXForm. Then you get for example 1+x[13]//TeXForm $x_{13}+1$ The Format can't be specified directly for TeXForm ...


13

Why we're getting this buggy result In process of conversion to $\TeX$, whenever Mathematica encounters "something delimited" i.e. RowBox with something surrounded with Strings matching: "(" | "[" | "\[LeftModified]" | "\[LeftDoubleBracket]" | "{" | "\[Piecewise]" | "\[LeftFloor]" | "\[LeftCeiling]" | "\[LeftAngleBracket]" | "\[LeftSkeleton]" | "«" | ...


12

The absolutely fastest way I know to get high-quality latex output is: Make sure you use LyX as the editor (http://www.lyx.org/) In MMA, highlight the plot, select "Copy as ... PDF" from the Edit menu In Lyx, paste wherever you want, that's it. The PDF will be saved under a default numbered file name (you can optionally rename it) Run pdflatex from the ...


12

Select the text, right click, and select Copy As -> LaTex.


12

If you create a notebook with some plots and then save it as LaTeX, not only will the images all be generated but so will LaTeX code that you can use to include those images.


12

You can use Mathematica-generated PDF graphics in LaTeX, using the pdflatex engine. I have been doing this for years. You have several options Use a font such as Times that will embed properly in the PDF, and a LaTeX package that uses matching fonts, such as mathptmx, txfonts or tex-gyre Termes. (There are actually many different font options in LaTeX ...


12

TeXForm is indeed your friend. It even gives you nicely formatted code: Table[RandomInteger[10], {3}, {4}] // TeXForm gives (* \left( \begin{array}{cccc} 9 & 5 & 10 & 9 \\ 6 & 10 & 3 & 9 \\ 9 & 5 & 9 & 7 \\ \end{array} \right) *)


12

I am not willing to make MaTeX compatible with Mathematica 9 for the simple reason that it would create too much of a maintenance burden, and I already don't have time to properly respond to all support requests. If anyone is willing to hack MaTeX to work with Mathematica 9, here's what needs to be done. The primary reason why Mathematica 10 is required ...


11

Here is a start (adjusted based on Szabolcs's statement that Row and TeXForm don't work together in v9): Clear[n] # == ReleaseHold[#] & /@ Array[HoldForm[Sum[i^#, {i, 1, n}]] &, 5] // Column // TeXForm $\begin{array}{l} \sum _{i=1}^n i^1=\frac{1}{2} n (n+1) \\ \sum _{i=1}^n i^2=\frac{1}{6} n (n+1) (2 n+1) \\ \sum _{i=1}^n i^3=\frac{1}{4} ...


11

Here's a way that I find clear: Make sure i and n have no value: i=.; n=.. Generate a list of the held sum expressions, taking care to make the exponent go away from $i^1$. list = Table[With[{e = i^k}, HoldForm[Sum[e, {i, 1, n}]]], {k, 5}] Use ReleaseHold to make a table of results: TeXForm@TableForm[# == ReleaseHold[#] & /@ list] $$ ...


11

Caveat: Since this uses hidden, undocumented functions, it will probably break at some point in the future. Also, I do not have any knowledge of how these functions work, except guesses from observed behavior. Some information is available via Information. Under the hood of TexForm is Convert`TeX`ExpressionToTeX, which in turn calls Convert`TeX`BoxesToTeX ...


11

There are a few ways to do this. The easiest is probably the switch off the script level changes that are taking place by selecting the cell bracket and setting AllowScriptLevelChange->False in the options inspector: For more subtle tweeking you need to leave AllowScriptLevelChange->True and adjust ScriptSizeMultipliers. For example with ...


10

As explained in the section tutorial/CitationManagement you need to have EndNote or BibTeX for managing your citations. Interaction with both is covered in this tutorial. Below is the result I obtained using the sample BiBTeX file downloaded here. Don't forget to work in a cell with the Text style (Alt-7 on Windows) when you use this, otherwise the ...


9

I've got my own package that I've used for a few years to generate LaTeX from Mathematica. All the labs on my Mathematica course page were produced with this package. Here's a handout on probability theory for Calc II students that was produced by the package. Unfortunately, it's not at all polished and really not usable by anyone but me. I can present ...


9

This is not a full answer, just a starting point: I would first write some functions that convert Mathematica graphics to a representation that is really close to the structure TikZ uses (similar to how Mathematica represents C using SymbolicC). I don't know TikZ, so this should be designed by someone who is quite familiar with it. Then I'd write a set of ...


9

I usually Export to hi-res PNG bitmaps for ease of use (there are a number of discussions on how best to export high-quality images on this forum. Take a peek at the right column of this page under "Related"). Personally I like notebooks that do not need any mouse-clicking or any other user interaction to produce output which makes reruns that much more ...


9

About the size of 3d graphics, have you tried the ImageSize option in functions like Plot3D? For instance, Export["~/Desktop/p2.pdf", Rasterize[ Plot3D[ Sin[x^2 + y^2]/Sqrt[x^2 + y^2], {x, -Pi, Pi}, {y, -Pi, Pi} ], ImageSize -> 1000 ] ] exports a 527KB pdf file here, which looks OK on screen (without rasterizing, you get a 14.4MB ...


9

I do not think what you are asking for is possible. But you can do what you want by numbering an equation in Mathematica like this do not know if this will meet your needs. Using Mathematica like Latex is not really practical or useful. I found it is better to just use Latex for typesetting, and use Mathematica for doing the computation and analysis.


9

The following Mathematica construction translates to $\TeX$ just fine: \left( \begin{array}{c} e_{\bot } \\ e_{\parallel } \\ \end{array} \right) Which looks like this in StackExchange's MathJax: $\left( \begin{array}{c} e_{\bot } \\ e_{\parallel } \\ \end{array} \right)$ The key issue is to enter the initial Mathematica construction ...


8

One way to speed up the workflow is to batch process all your images and even formulas if you have many. Basically do all your work in the Mathematica notebook placing distinct graphics, formulas and text in separate cells. Then choose File > Save As... and pick LaTeX Document (*.tex) from the drop down menu of popped up window. This will produce a set of ...



Only top voted, non community-wiki answers of a minimum length are eligible