How to conver files from .tex to .docx while keep the itatic math symbols? - ms-word

I'm using \bm to set the itatic math symbols in latex.
Now, I need to convert my latex files to docx files.
But I found that pandoc only uses the default Cambria Math font.
And there are two problems:
The orginial boldfaced Latex math symbols are not itatic anymore.
How to change the math font in pandoc terminal command?
Exampl: demo.tex
\begin{equation}
\underset{f_t(\cdot)}{argmin}: \mathcal{R}=E\left[\mathcal{L}\left(f_t\left(\bm{X}_t \mid \bm{X}_s, \bm{Y}_s^{c}, {\bm{\theta}}, \bm{H}_{A}, \bm{Y}_s^{n}\right), \bm{Y}_t\right)\right]
\label{eq:ALDBT_risk}
\end{equation}
My pandoc command is as follows:
pandoc demo.tex -o demo.docx

I did not find a direct solution by Pandoc.
As an alternative, we may use MathType.
If we want to use Latin Mordern Math, we may refer to this post.
Then define Bold/Itatic for matrices/vectors in MathType/formatting/Definition/. as illusrated in Figure 1.
Finally, conduct step 1 and step 2 as illusrated in Figure 2, sequentially

Related

refman.rtf fails to use equation from '*.md' in doxygen

I use '.md' to generate '(index).html' and '(refman*).rtf' documentation with doxygen 1.8.14.
The mathematical equation in '*.md' gives a correct equation in html output but not in the file 'refman.rtf'. The other theoretical parts like paragraph and other stuff work well between *.md and rtf output.
I guess *.rtf is not recognizing the equation part of the *.md document.
Does the RTF generation through doxygen read the *.md files?
Do I need to change any tag to make *.md work with rtf output?
Not only for markdown but also for "normal" doxygen input formulas do not work.
From the documentation:
Doxygen allows you to put LATEX formulas in the output (this works
only for the HTML and LATEX output, not for the RTF nor for the man
page output).
A workaround workflow, at the moment for non inline formulas, is to do something like:
Create an image with the formula e.g in a dummy doxygen run where one does not use MATHJAX, this will result in an image with a name like: 'form_0.png'.
In the code one has to place an if construct like:
\if rtf_run
\image rtf form_0.png
\else
\f... with the formula
\endif
One now has to run doxygen twice:
once for the output without rtf, i.e. without setting rtf_run in ENABLED_SECTIONS
once for rtf output by setting rtf_run in ENABLED_SECTIONS
EDIT June 5, 2018: I've just pushed a proposed patch to github pull request 756. Here the formulas are rendered as png images and included in the RTF documentation.
EDIT: 2018/06/10: The push request has been integrated in the master version on github.

Import docx file into emacs org-mode

I have been scouring the web for hours now and I haven't found a complete answer. I am wanting to convert my .org file to .docx (and docx. to .org) while maintaining the sections and tables. I have found and tried using pandoc through powershell as a tool to do this but I believe I am not doing any thing.
Here is the command I type into pandec:
pandoc report7a.org -s -o report7.docx
Shows the error:
pandoc.exe: Cannot decode byte '\xfe': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
I have little experience with doing stuff like this.
Here is an image of the .org file I want to convert
I think that your editor put the byte order mark (BOM) into begin of the file. Check this post on how to do it with Emacs.

How can I import .eps in Mathematica without losing the text?

I am trying to import a histogram produced by Stata as an .eps file into Mathematica, but it does not display axes' labels. That is, for some reason, Mathematica does not import .eps as but rather transforms it.
How can I avoid that? As of now, I am using plain
Import["~/hst.eps"]
I had a similar problem with LateX and a pdf graph recently, which also manifested itself with the eps version. I wound up modifying the user-written graphexportpdf and things seemed to work out. Perhaps you will find this solution helpful.
Mathematica currently (v.9) usually cannot import textual elements from .eps files properly. One possible solution would be to export your plot as .pdf rather than .eps from you plotting software and then Import generated .pdf. If you need to import the text as text you can turn off outlining by using the "TextOutlines" -> False option.
If exporting to .pdf from your plotting software is not possible you can convert .eps to .pdf by another program and then Import generated .pdf as above.
For your file orders_weekly.eps using the gsEPS2PDFEmbedFonts function and then Importing generated .pdf, I get (Mathematica 8.0.4):
gsEPS2PDFEmbedFonts["orders_weekly.eps", "orders_weekly.pdf"]
graphics=First#Import["orders_weekly.pdf"(*,"TextOutlines"->False*)];
Show[graphics, Frame -> True, PlotRange -> All, ImageSize -> Automatic]
I have commented the "TextOutlines" -> False option because Mathematica 8.0.4 still imports rotated text incorrectly with it. I haven't tested it with v.9 though.
Another possibility is to convert all the glypth in the .eps file to oultines. Based on Jens Nöckel's code,
gsEPS2outlinedEPS[epsPath_String, outlinedEPSPath_String] :=
Run["gswin64c.exe -sDEVICE=epswrite -dNOCACHE -sOutputFile=\"" <>
outlinedEPSPath <> "\" -q -dbatch -dNOPAUSE \"" <> epsPath <>
"\" -c quit"]
Here gswin64c.exe is the name of GhostScript executable for 64bit Windows systems, for Linux replace it with gs.
Note that you should have GhostScript installed and configured (for Windows you should add gs\bin and gs\lib to the PATH, where gs is the top-level Ghostscript directory)

how can I display knitR markdown in a pandoc rendered pdf

I wish to show the knitR code in the final PDF together with its execution result.
I did not find yet a working way to fence "tripple-backticks"{r}..."tripple-backticks" blocks in the knitR code and see them as-is in the final PDF.
The backticks get interpreted whatever I do.
This is for tutorial purpose so that people see how to write knitR markdown. The use of html "pre" tags around the block of code leads to removal of the code.
for instance I wish to see this example fully first and then the result thereof
adding 4 spaces before each line like here does not work in RStudio and knit HTML fails
```{r test-haskell, engine='haskell', engine.path='ghc', cache=TRUE}
[x | x <- [1..10], odd x]
```
follow-up addition
I include here some RStudio Rmd code that leads to unexpected PDF content
in the pdf, the pre-code block simply disappeared.
The only fix I found is to invent a fake tag 'rmd' to fence the pieces of markdown I wish to keep as-is. I suspect this is a pandoc issue rather than knitr, unless there is a better way to fence code in knitr. The code I wish to keep can be any of bash, perl, R, or any other manguage used to process the data in the knitr tutorial.
my pandoc command was:
pandoc --variable=geometry:'top=1.5cm, bottom=1.5cm, left=2cm,
right=1cm' --variable=papersize:'a4paper' --number-sections
--table-of-contents --template=default.latex --highlight-style tango testrmd.md -o testrmd.pdf
Can it come from the template I used (default.latex)? It is the only template I found that meets my needs for vignette-like output. Same about 'tango' which is the only coloring scheme that shows some light background in code blocks.
As you see from the screenshots above I am a new-bee here (both in markdown and latex). Thanks for any help

Microsoft Word to Org-mode

I am trying to put the Microsoft Word document in emacs using org-mode. I have copied the Word Document and pasted in emacs. I like to achieve the headings like 7.1.2.4 in org-mode format.
and then link the TOC to appropriate headings. How I can do that? Any suggestions? Any programming language like Perl has done it?
Thanks.
There is ODT2ORG (https://bitbucket.org/josemaria.alkala/odt2org/wiki/Home) which lets you import odt files in org-mode.
Use Openoffice/Libreoffice to produce an .odt from your .doc.
Use odt2org to get an .org.
About the headings: I am not entirely sure I understand you.
there is org-toc.el included in org-mode that provides a seperate buffer with a TOC of your current document (like in Reftex). All the entries there are already links to the individual headings. Also, an exported document will have a TOC included by default without your intervention.
Orgmode does not support automatically numbered headings (yet). However, if you want to export your document to html, docbook, latex, or pdf, your headings will appear numbered and nested (you can tweak the settings quite a lot).
I doubt that you will get your intended result purely automatically but it should work 70% automatically, especially if you have latex installed and simply want to have a good-looking pdf in the end. Convert doc to odt, convert odt to org, open and type "C-c C-e d".
Another option: Save as an HTML file, then use Pandoc to convert the HTML to an .org file.
I've converted loads of Word documents into Org files. It takes minutes to do it by hand.
If you want cross-references, use internal links (4.2 in the current manual).
The * and ** style headings are always likely to be there in Org. Think of the use case where exports are compiled from #+INCLUDEd files, or you have done a selective export using tags. Any kind of single sourcing technology isn't going to display the numbering.
There is a ruby gem which converts doc to md. With pandoc you can convert to org.
https://github.com/benbalter/word-to-markdown