Tag Info

Hot answers tagged

21

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


15

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


14

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


14

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


12

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


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

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


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

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

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


8

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


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.


7

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


7

As others have pointed out, automatic numbering is nicely taken care of through the built-in DisplayFormulaNumbered style. Custom numbering (both a separate counter and counting sequence) can be introduced into stylesheets, for example, I have made a Theorem style before. However, for a one off equation numbers / labels, like the $\LaTeX$ \tag option, you ...


6

The way you do this - by saving the whole notebook with un-formatted In/Out cells - will get you a file with non-traditional working Mathematica notation. For example you will get square brackets for functions instead of round ones and capitalized functions names. If your goal is just to get a nicely formatted formula in TeX form, you could use this (for ...


6

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


6

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


6

When you export the whole cell and not only its content, then you should get LaTeX code which is not one big math-environment. Maybe one easy way is to create a new notebook with nb = CreateDocument[] then you copy your text-cell in it and if you then Export is as "LaTeX", you get the correct code. For example, if I have this I can simply use ...


5

Personally I'm always disappointed by the quality of the conversion done when one simply saves a notebook as a TeX file--it never looks like what I want or expected. But perhaps this isn't too surprising, as the two file types are very different, and therefore many choices need to be made about the conversion. I think a good general approach for solving ...


5

May be its a matter of using GraphicsRow? plot = GraphicsRow[{ BarChart[Table[i, {i, 5}], ChartStyle -> "DarkRainbow"], BarChart[{{1, 2, 3}, {1, 3, 2}}] }] Export["test.tex",plot]; works. I didn't know you could export directly graphs to TeX so I learnt something! ;-)


5

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


5

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


5

Edit An updated version of this answer is here. I forgot that there was some duplication when I posted the linked answer, but the material in that answer is more recent so I'll update that one and leave this post unchanged. End edit The conversion from $\LaTeX$ in general is rather quirky, but I don't see a failure of the kind you see. However, there is ...


5

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


5

The regular expression approach is my favorite, but I would do it a little differently to make it more robust. The approach by David didn't quite get the } treated right. The approach by R.M relied on the newline characters in the file (but newlines are optional in $\TeX$). So here is what I believe fixes these problems. First define the example $\TeX$ ...


5

Perhaps something like this could help? SetAttributes[copyAsLatex, HoldFirst]; copyAsLatex[sth_] := CopyToClipboard[ToString[HoldForm[sth] /. x_ /y_ :> Divide[x, y], TeXForm]] So copyAsLatex[ U[x, y] = Subscript[E, 0]/(4 \[Pi]) E^(I k Subscript[z, 1])/ Subscript[z, 1] E^(I k/(2 Subscript[z, 1]) ((\[Xi] - x)^2 + (\[Eta] - y)^2))] ...


4

The immediate problem with the LaTeX is that \( and \) appear twice. Thus, the following works fine, assuming the setspace package has been loaded. \begin{doublespace} \noindent\(\{0,10,1\}\) \end{doublespace} Another question, of course, is why this export went wrong and how to change that. That's hard to say without seeing the Mathematica expression.


4

Here's a way using StringSplit and StringCases. The file test.tex is a file with your tex example. tex = StringSplit[Import["test.tex", "Text"], "\n"] StringCases[tex, "\\commandname" ~~ LetterCharacter .. ~~ "{" ~~ x__ ~~ "}" :> x] // Flatten (* Out[1]= {"Bob", "It wasn't Bob", "2012", "$\frac{1}{3}$", "\commandnameF{It was Bob!}", "29"} *)



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