Tag Info

Hot answers tagged

26

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[] ...


26

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} ...


23

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] ...


21

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 ...


20

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[ { ...


20

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 ...


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 ...


17

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 ...


15

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 ...


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 ...


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

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) *)


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] $$ ...


10

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 ...


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

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

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 ...


9

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

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

This seems to work, at least for your example: TraditionalForm @ Grid[{{Null, Grid[{{x, y}}]}, {TableForm@{{A}, {B}}, MatrixForm[IdentityMatrix[2]]}}] You can make a little function that generalises it: makeBordermatrix[mat_?MatrixQ, top_?VectorQ, side_?VectorQ] := TraditionalForm@ Grid[{{Null, Grid[{top}]}, {TableForm[Transpose@{side}], ...


8

If you just want the output, well, write it manually. EscpwEsc gives you the piecewise bracket. Then you can insert a table (Insert->Table/Matrix) or learn the shortcuts with Ctrl, and CtrlReturn, etc. I got this box structure. You can see the result by running. RawBoxes@FormBox[ RowBox[{"\[Piecewise]", GridBox[{{RowBox[{"0", ","}], ...


8

It looks like AuthorTools is still around: here:


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 ...


8

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.


8

The variable name E isn't available in Mathematica because it's a built-in symbol, but you can define a new name for the energy and use Format to make it display as E. The compromise is that you then have to enter the $\LaTeX$ code using the new name - here I call it energy: Format[energy, StandardForm] := "E" ToExpression["energy = m c^2", TeXForm, ...


8

Here is a very robust (!!) method expr = (z14 z43 (z01 + z03 + z12 + z32) + z01 z12 z43 + z03 z14 z32); StringReplace[ToString[expr, TeXForm], " " :> "\\times"] Using Ctrl+Shift+C to copy as plain text results in ...


7

I usually draw only the non-textual part in Mathematica export it as PDF (if the graphic is simple) and do all text typesetting in LaTeX to get a consistent use of fonts across the document. This is mainly manual labor. On the LaTeX side I use TikZ. This entry on TeX.SE might be a starting point. There is a solution for SVGs comming from Inkscape. I have ...



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