org mode export to markdown and character entity problems - emacs

I need to export a lot of documents written with Emacs-Orgto markdown. I am using the export via-pandoc. Everything works fine except for the multitude of special symbols written using org-syntax. Just an example the β character which in org is written \beta in the exported document I have \\beta instead of β . Is there a way to fix this instead of manually change few hundreds of symbols ?

To replace text in a single file, you simply type M-x replace-string. To replace strings for multiple files, follow the following instructions:
Assemble a list of files you want to operate on with either find-dired, find-name-dired or find-grep-dired.
Mark all files in the resulting Dired buffer using t.
Use Q to start a query-replace-regexp session on the marked files.
To accept all replacements in each file, hit !.

I don't use pandoc but with a similar problem exporting org-mode files to html I found I needed to enter the entities as '\beta{}' and not just as '\beta' (without the quotes)

Related

Emacs: How to associate different initialization configurations with different file formats?

What's the best way to associate file extensions with my own customizations? For example, when I open a .py file the frame would be bigger and split into 2 windows, but when a .tex file is opened the frame would be smaller with just one window. Should I split my .emacs and write all configurations associated with python in a .el file (key bindings, python shell = ipython, etc ...) and for latex in another .el file (load auctex, pdf mode = default, etc ...)? How would I "call" the files and make them work appropriately (if that'a possible and good solution)?
(First, +1 to #phils's comment. You will get better help if you are more specific about what you need/want.)
Depending on just what you need/want, see also variable (not option) file-name-handler-alist. You might not need it, but you might.
You can make use of it if you intend all or particular operations on the files to involve additional actions (such as those you describe). For any operations where you do not need special treatment, just provide the default behavior. For the others, provide the default behavior plus the extra behavior (in whichever order is appropriate).
See (elisp) Magic File Names for more information.

export from Emacs in rtf using current font-lock?

I'd like to export my latex files (and maybe other files) as rtf files, so that the syntax highlighting will be kept (that is - keep it 'plain text' with colors).
I tried using Org-mode to convert to HTML (thinking later to copy it into LibreOffice and hope for good results), but I couldn't make Org export it with the correct colors.
Is there a way to export buffer to rtf using the current font-lock ?
I think you're looking for M-x htmlfontify-buffer.
You can also take a look at http://www.emacswiki.org/emacs/Htmlize

Can I inline a org file inside another org file?

In latex we can split a big document(paper.tex) into several tex files(abstract.tex,intro.tex ...) which can be inserted inline using \input{paper.tex}.
Is there a similar facility in org-mode?
Just use the include command i.e.
#+INCLUDE abstract.org
#+INCLUDE intro.org
This will inline abstract.org and intro.org in the current org file. See also the org-mode documentation on include files.
Without test, but I think you can just simply add the latex command \input{paper.tex} in any place of .org file you want. It will render the .tex file to final file.
PS: other option: Include-files which are mentioned in the comment.

Rename file containing '©' character

We received as input in our application (running on Windows) a list of files. These files were automatically extracted from a database with a script.
Apparently some of the names are containing special characters (like accents) and these characters are rendered as '©' on our side.
How can rename programmatically these text files (around 900'000) to get rid of this character?
We cannot change the source neither re-extract the files.
The problem is that because of this character another program involved with our system does not accept the files.
Have a look at the unix command rename. It allows you to apply a perl regex to the names of a bunch of files. In this case you might want something like:
$ rename 's/[^a-zA-Z0-9]//' *
In debian the rename command is part of the perl package. It should also be available on CPAN.
I ended up creating a new script that reads the input files and search for special characters in their title.
It was quite easy indeed:
string filename = filename.Replace("©", "e");
Since the '©' is in the filename, the script (in C#) is able to recognize it and replace the match accordingly. In this way I can loop through all the folders and subfolders simply reading the filename and change specials characters.
Thank you all for the contributions!

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