I have a question in need of an Emacs expert, perhaps someone who is knowledgeable additionally in HTML/LaTeX, but someone who is primarily an emacs expert.
While writing files to typeset documents (in HTML, LaTeX, ..) I would like to make sure that I am including the right images, in HTML whenever I use <img ...> and in LaTeX whenever I use \includegraphics{...}.
Is there a way to include an image within the emacs buffer, either automatically or when I hover over the tag/command?
For LaTex, you can use the AUCTeX package. After you install it you can toggle image previews with C-c C-p C-p.
More information about AUCTeX is available at:
http://www.gnu.org/s/auctex/
The preview mode is called preview-latex, User's Manual is located here:
http://www.gnu.org/s/auctex/manual/preview-latex.index.html
You can use the inline image mode:
https://github.com/Wilfred/remacs/blob/master/lisp/iimage.el
If you are doing a lot of TeXing, AUCTeX is awesome. However, for a little less syntax-heavy option, you can learn org-mode and then export to latex.
http://orgmode.org/
http://orgmode.org/manual/LaTeX_002fPDF-export-commands.html
http://floatsolutions.com/blog/2010/10/displaying-inline-images-in-emacs-org-mode/
I think that the org-mode + inline image + LaTeX export (a native feature of org-mode) will be the best way to go. Org-mode is quite easy to learn, extremely well supported, has a great community, and the LaTeX export works really well. Then, you can just tweak the latex that org-mode generates, but the org-mode export will do 99% of the work, effectively making it WYSIWYG for images, tables, etc.
Related
I am running Emacs Live with Rinari. In .erb files html-mode is enabled automatically, however embedded Ruby is not highlighted according to ruby-mode. Is there any way to enable both html-mode and ruby-mode within .html.erb files?
Check out web-mode, which is designed for HTML templating. It can be installed via MELPA or Marmalade. (Note that this is not a way to run html-mode and ruby-mode simultaneously as you requested; it's a completely different mode. It's also probably your best bet.)
Out of the box, it supports .html.erb (and many others), with superficial CSS and JavaScript support (highlighting and indenting).
Install 'rinari' for emacs which is specially for ROR. It has a mode called eruby-nxhtml-mumamo-mode which hightlights the html.erb syntax as we need. This link will help you how to install it. It takes care of everything. Enjoy!
Recently, I do some reverse engineering, But I can't find the hex editor like 010 editor in Linux.
I heard the emacs can customizing a lot of thing via lisp. I wonder if emacs can have 010 editor
template function. If it can I decide to learn emacs with lisp.
I don't know the 010 editor, so I can't judge whether Emacs's support for hex editing is anywhere near comparable (Emacs's hex editing mode is not particularly sophisticated), but you can try it with M-x hexl-mode RET.
Emacs is not your tool of choice for this. It is not the best for everything (although we all try). hexl-mode is nice but if you try to open a really large file or a disk image or the like things will go down hill quickly.
You are better off helping improve existing open source hex editors and there are plenty of them.
If you need to explore binary files on Linux, you can give a try with hachoir. It is a a library written in python that can help to retrieve and browse internal file structures, plus several viewer applications built upon it.
Certainly you can open very large file now with VLF minor mode.
Emacs does have some support for decoding binary data but its a bit more manual than 010 editor - see bindat in the emacs manual.
Basically you describe a template for your data and then use elisp to decode it so you need to do some basic elisp coding but the example shown at the bottom of that page should get you started.
I am using emacs org-mode for managing my notes. Often I wish to use links to this notes from files, which I am editing in other modes, like AUCTeX.
See here for a descriptive screenshot. (I am not yet allowed to post images here.)
Storing and following this links works pretty well. But I find it disturbing to read the full org syntax of the links: [[file:notes.org::*note][Description]], which is obviously not folded outside of org-mode.
I wonder if there is any minor-mode which provides the folding of such links to a clickable Description, like it is done in org-mode.
You can use links outside Org-mode.
4.5 Using links outside Org
You can insert and follow links that have Org syntax not only in Org, but in any Emacs buffer. For this, you should create two global commands, like this (please select suitable global keys yourself):
(global-set-key "\C-c L" 'org-insert-link-global)
(global-set-key "\C-c o" 'org-open-at-point-global)
-- Source: Using-links-outside-Org
Edit (1 Nov 2012): As of October 2011 the minor mode enabling org-like links didn't exist, but there were discussions. Now the minor mode exists, it is called org-link-minor-mode and is included in org-contrib.
I think the standard answer would be to use the publishing methods within org-mode to publish to a different file type, and link to that instead. Publishing, once set up, is really easy and fast to use and can produce things like html files that you could safely link to from something else (that is hopefully HTML compliant). Since you didn't say what the other-thing(s) is that you're using it's hard to recommend a good publishing output.
OK, I know you're going to point me to EmacsWiki page, but here's the deal. I'd like to use the default Emacs mode for a given file type, and change mode after specific tag, say <% %>. By doing such, I can switch the mode inside the tags, and return to default mode when cursor is not inside tags.
And no, I don't need ASP/PHP mode, it just that I find boring M-x-ing all the time in order to change the mode. I'm using Emacs 23.2.1 on Arch Linux FWIW. Any ideas?
Have a look at mmm-mode: http://sourceforge.net/projects/mmm-mode/ or noweb-mode. Here are instructions for getting mmm-mode to work with literate Haskell documents. And here is the configuration I use for noweb-mode with literate (rst+python) Python documents.
nXhtml
nXhtml is an addon to Emacs for editing XHTML, PHP and similar things.
nXhtml comes with MuMaMo (Multiple Master Major Mode), which I think is a newer version of mmm-mode. I use it all the time when editing Django HTML files which combine CSS, JavaScript and Django-aware HTML modes.
Is it what are you looking for :
http://www.emacswiki.org/emacs/PhpMode#toc8
You probably want to adapt it to fit your need
Having made the jump just recently from XEmacs to GNU Emacs, I'm really loving nXhtml mode for writing web code. I'd like to be able to add a sub mode to it, though, and I'm not sure how. There doesn't seem to be a good reference to do so.
I have a mode for Perl's Template Toolkit, loaded as tt-mode and the default for .tmpl files, and I'd like to use nXhtml for my .tmpl files, with tt-mode taking over only between the [% %] tags.
Well, it appears (after some digging), that modes are defined in util/mumamo-fun.el, and there is already a Template Toolkit mode defined.
EDIT: Took out my original notes about having a problem with automatically loading it, because I was doing something dumb. :P)
Setting it up automatically was pretty simple:
(require 'mumamo-fun)
(setq auto-mode-alist (append '(("\\.tmpl$" . tt-html-mumamo)) auto-mode-alist))
Voila!
It looks like setting up other new modes is a fairly simple process. util/mumamo-fun.el contains the templates for all of the submodes. Following that format, it defines functions for finding chunks of the buffer that define a certain submode, and then builds them with other chunks (like the inline css and javascript, etc) into something that mumamo understands. I haven't actually tried to build a different mode, though, so I'm not sure if there is any additional work that needs to be done, but once defined, they seem to be registered with mumamo automatically.