Mathematica: Building a document with your calculations - wolfram-mathematica

I have a Mathematica Notebook with Plot's, Images, Tables and text that I would like to present in a file. I've tried to append >>> all the stuff in a nb or m put that leads to nothing (the plot comes up as -graphic-).
I'm sure a lot of people have done this before! What is the best approach for such a task?

Why don't you just save your current notebook as PDF, using the File menu, perhaps after applying a suitable stylesheet? or is this Mac only functionality?

Related

Working with a text editor for julia language in Windows OS

Hey i am new in the coding area. And i want to know how can i load a code part that wrote with a text editor(Sublime) in Julia .I am working on windows OS and i do not know how can i run a code part. I load julia 1.1 but i dont want to code row by row. I want to a code part and then run it somewhere but i dont know how can i do these process and their term names.Briefly ican say that i want to generate a sparse matrix and vectors many density and sizes elements and then i want to multiple them. Could u explain step by step what should i do and which way i should go. Thank you.
There is the Sublime Text Plugin SendCode which allows you to send pieces of code from Sublime to, for example, the Julia REPL by pressing CTRL+Enter (or Shift+Enter to send a whole block). Just follow the installation and usage instructions on their webpage.

markdown or markup to powerpoint?

I need to maintain some slides in both latex beamer and in powerpoint. (This is to make slides available for instructors elsewhere, too, 90% of which do not know how to use latex and are unwilling to learn it. and I am a latex guy on linux.)
I have tried the route via Libreoffice (and opendocument), but this did not come out well. right now, the best method that I have found is to author pdf in beamer, then run it through a nuance OCR program to get MS Word...and not even go all the way to Powerpoint (which is where I really need to be).
If I only had a markup language that produced nice Powerpoint, I could probably code a perl translator from markdown to this intermediate markup language. (going from markdown to latex beamer is relatively easy.)
I don't think this exists, but hope springs eternal. after all, it is almost 2014 now. does anyone know of a solution?
One solution is to use odpdown: It converts markdown to the OpenOffice Presenter format, which can be imported into PowerPoint.
It is not yet complete, i.e. table support is missing and possibly not running on certain Windows setups, but nevertheless it could be a start. Possibly, you have Linux running, where it seems to work.
Steve Rindsberg's answer in the comments works on PP 2007 works! Let me repeat it here:
I suspect that PowerPoint is the likeliest solution. ;-) But what sort
of slides are you creating? If they're simple heading and bullet point
slides, all you need to produce is a simple text file. Any text that
starts in the left column will be the heading of a new slide. Indent
one tab and it becomes a first-level bullet point under the current
heading; indent two tabs, it becomes a second level bullet point and
so on. Simply use File | Open on the text file to pull it into PPT.
Steve: Is this all that PP converts? Or is there a reference of other "sneaky" markup that PP knows about?
(pandoc: unfortunately, the conversion from libreoffice to powerpoint is pretty poor when I tried it last. I also tried to save and understand the powerpoint xml format, but that was REAL bad.)
The easiest way to handle this is to work with:
RStudio (and R if not already installed)
RMarkdown
Pandoc 2.0.5 (minimum)
Install those 3 (or 4) items, then read: https://bookdown.org/yihui/rmarkdown/powerpoint-presentation.html
The installation time is worth the time saved copy-pasting everything from scratch.
I also am a Linux guy and I also use LateX engines to create nice documents. Based on my experience, here's what you should do :
Stop writing directly in LaTeX and start using org-mode to write documents instead (I spent years writing in LaTeX and now it's over (except when I use modernv package))
Org supports latex math formulas and .org files are easily exported in .tex files
Org can also be easily exported in markdown
Once you have your markdown, there are several tools that will allow you to create a PowerPoint. Two of them are pandoc and md2pptx

Matlab GUI: migrate a plot to a new window

I've encountered such a problem, and hope you guys could help me out here.
I have a plot in my GUI, contained multiple lines with different linspecs and a group of legends.
And I've made a context menu which should allow users to open the EXACTLY same plot(retaining all line settings, title, legends, and so forth) in a new window(default figure, where it is able to save/edit the figure).
However I couldn't find a simple way to migrate the plot, except re-run the plot commands which is quite complicated(plot different data, etc.)
So, I am looking for the solution in the following two ways:
is there a simple way to migrate the plot into new figure window?
or is it possible to save the plot directly with current interface?
For 2, I'd like to clarify that I only want to save the plot, not all GUI interface. I've tried saveas(handle.Plot,...) but it saved the GUI interface as an entity.
I hope the point has been made clear, thanks for your time. Cheers.
For this task you can probably use the builtin Matlab function copyobj which does exactly this (i.e. the first option mentionned in your question).
The following piece of code demonstrates its usage:
h1=figure;
a1=plot((1:100),rand(1,100),'r-');
hold on
plot((1:100),rand(1,100),'b+');
legend({'plot1';'plot2'});
h2=figure;
copyobj(get(h1,'children'),h2);
Hope it works as well in your case.
UPDATE: as far as I understand this, your second solution would involve the saveas function which unfortunately works with the figure environment and not with axes (as you experienced it). So a workaround would probably involve copying the desired axes to a new figure with the method given above and then use saveas.

Ways to work around Mathematica Notation bug?

Mathematica offers the Notation package to define custom notation, and it seems to work great until I save a notebook with custom notation as a package and try to use Needs["..."] to import the new notation. As documented on the Mathematica mailing list, this causes bizarre syntax errors when evaluating any call to Notation[]. The suggested solution is to manually open the notation notebook and evaluate it into the kernel, but this is a pain for files that I plan on distributing. If anyone has a better workaround for the problem, I'd really appreciate the help!
I think your problem lies in the way Mathematica treats Notation[], quote:
When defining your own notations it is
critically important to use the
notation templates. The reason for
this restriction is that the templates
pasted into a notebook contain
essential tag boxes embedded in the
correct way.
It may not be possible at all to have a package file call Notation[], but there is a suggestion of using ParsedBoxWrapper which I didn't have time to play around with right now.
There is a kludgy solution to your problem, which is that you put all the Notation[] assignments into one cell of the Notebook and make it an initialization cell (right click on the cell edge --> Initalization Cell). This will incidentally also create a .m file with just the contents of that cell (but this file will, alas, not work with Needs[] or <<). After that you can collapse the cell, make it uneditable, unevaluatable, and hey presto! Almost like what you want.
I should note that from a distribution point of view this kludge is rather nice since the .m file gets regenerated every time you load the main file so you don't need to ship multiple files. The only downside is a slightly ugly Notebook (i.e. one hidden cell), and a pop up asking whether you want to evaluate the initialization cells of the Notebook whenever you first evaluate something in that Notebook.

Creating nice pdfs with ruby

I would like to create pdfs with ruby. One special need is embedding a picture into text (or a textblock), which means I need to be able to let the text flow around the image. E.g. the image should be in the rigth upper corner and the text should start left of the image and continue after the image by using the whole width of the page. How can I do this in ruby? Thank you for any suggestions!
In the past to get print quality PDFs in Ruby, I used rtex.
It's fast too, which is a real bonus.
Prawn to the rescue?
I like the html -> pdf approach. Although it is probably not the best option (prawn is) it makes it easy to design the pdf. See this website. You could also go for the approach documented at jimneath.org.
Good luck
iText is the heavyweight that will allow you to do anything you want with PDFs you can bridge to it with jRuby.
Another option I used was driving open office (it has a ui less option which you can automate from Ruby)
How about having Ruby generate some LaTeX code, then use pdflatex to produce the PDF?
Although I haven't done it myself I've seen people use a headless Open Office. You can control it from Ruby and use it to generate PDF files. You can even use an Open Office template and just fill in some elements into it.

Resources