Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting max-width for HTML export in Emacs org-mode

Tags:

org-mode

When I export an org-mode file to HTML, I'd like to limit the line width to make it easier to read. Can setting max-width with #+ATTR_HTML: help me do that? If so, how? If not, is there a way? I'd prefer doing it on a per-file basis rather than globally or per-paragraph.

I'm using Emacs 23.3.1 and org-mode 7.8.03.

like image 958
Bill Avatar asked Dec 24 '12 18:12

Bill


2 Answers

You can setup css style to limit max-width on a per-file basis:

#+HTML_HEAD: <style type="text/css">body{ max-width:50%; }</style>

Also there is a way on per-heading setup:

#+HTML_HEAD: <style type="text/css">#outline-container-introduction{ max-width:30%; }</style>

and then set property of concrete heading:

:PROPERTIES:
:CUSTOM_ID: introduction
:END:

Upd.: Replaced #+STYLE by #+HTML_HEAD

like image 90
artscan Avatar answered Feb 20 '23 15:02

artscan


Hi, there. Note that using only the max-width tag as advised above will place the entire body content to left by default. If you wanted, additionally, to center it on the screen, you need to add and set the margin tag to auto by adding margin: auto; It makes it to look much better for me, try it.

like image 25
Txe Llenne Avatar answered Feb 20 '23 14:02

Txe Llenne