From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: markup in environments in latex export Date: Sat, 2 May 2009 09:27:24 +0200 Message-ID: <9FAD8E9F-E4CD-4B9D-B4D3-8777EE965B0D@gmail.com> References: <86iql57zkh.fsf@portan.ibr.cs.tu-bs.de> <8663h47njt.fsf@portan.ibr.cs.tu-bs.de> <550FAA9A-10B7-4DED-A712-77D381F68748@gmail.com> <87r5zoo1uf.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M0eKk-0004GY-FR for emacs-orgmode@gnu.org; Sun, 03 May 2009 12:14:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M0eKg-0004F5-Lb for emacs-orgmode@gnu.org; Sun, 03 May 2009 12:14:30 -0400 Received: from [199.232.76.173] (port=45932 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M0eKg-0004F0-I7 for emacs-orgmode@gnu.org; Sun, 03 May 2009 12:14:26 -0400 Received: from ey-out-1920.google.com ([74.125.78.148]:4379) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M0eKg-0002U7-38 for emacs-orgmode@gnu.org; Sun, 03 May 2009 12:14:26 -0400 Received: by ey-out-1920.google.com with SMTP id 13so672967eye.24 for ; Sun, 03 May 2009 09:14:25 -0700 (PDT) In-Reply-To: <87r5zoo1uf.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Chris Gray Cc: emacs-orgmode@gnu.org Hi Chris, I have been pondering about this idea, and I prefer to not integrate it into the Org core because I think it may lead to undesired behavior, in particular in the other backends like docbook or ASCII. However, I have just created three new hooks * org-exp.el (org-export-preprocess-after-blockquote-hook): New hook. (org-export-preprocess-string): Run the new hook. * org-latex.el (org-export-latex-after-blockquotes-hook): New hook. (org-export-latex-preprocess): Run the new hook. * org-html.el (org-export-html-after-blockquotes-hook): New hook. (org-export-as-html): Run the new hook. which would allow to easily implement your idea as an add-on package that we could include in the contrib directory. Would you like to reformulate your patch into a small add-on? The only thing I would like to ask is to keep it LaTeX/HTML-specific, and this means that the action to turn #+begin_..... into the cookies should be wrapped into (when (or latexp htmlp) ....... ) latexp and htmlp are a local variables available when the first of the three hooks is run. - Carsten On Apr 19, 2009, at 9:55 PM, Chris Gray wrote: > Hi Carsten, > > I took up your challenge and made a patch that does what I want. It > does what I suggested in my previous email in that it allows one to > put #+begin_foo and #+end_foo tags in the body of an org file. These > tags allow you to change the environment of the text between them. > What that means is left up to the exporter. For example, in LaTeX, > the tags are expanded to \begin{foo} and \end{foo}, whereas in HTML, I > have the tags being expanded to
and
. (I am > not sure if that is the right thing to do in HTML...) The text > between the tags is not protected, and thus it is interpreted for > markup just as the rest of the file. > > I have left the old cases in place, so blockquote, verse, and center > should still have the same behaviour as before. The only behaviour > that changes is with #+begin_quote in HTML. This no longer generates > a blockquote, but a
. It would be easy to revert > this to the old behaviour if many people were using #+begin_quote with > HTML export. > > I have put the patches up in a github repository (basically because I > wanted to play with github), so you should be able to pull them from > the general-cookies branch of git://github.com/chrismgray/org-mode.git > > Cheers, > Chris > > Carsten Dominik wrote: > >> Hi Chris, > >> no, this is really by design the way it is. Org-mode has its own >> markup. As a bonus to people used to LaTeX, it allows certain >> LaTeX constructs to be intermingled into the file. For LaTeX >> export, it will export these *literally*, the entire construct. >> For HTML export, you can arrange for these snippets to be >> processed by LaTeX as well and then included as images, >> this is useful for formulas and some other constructs. > >> Here is a way to fool it: > >> \nop{}\begin{center} > >> - /a/ this is a >> - /b/ this is b > >> \begin{itemize} >> \item \emph{a} this is a >> \item \emph{b} this is b >> \end{itemize} > >> \nop{}\end{center} > >> - /a/ this is a >> - /b/ this is b > > >> Why does it fool it? Because it recognized full environments to be >> included >> by \begin ... \end, wit these macros at the beginning of the line. > >> If I were to allow what you propose, it would quickly become hard to >> know >> what should be LaTeX and what not. I think. > >> Feel free to try to make a patch that will convince me of the >> opposite. > >> - Carsten > > > >> On Apr 16, 2009, at 3:09 PM, Chris Gray wrote: > >>> Carsten Dominik wrote: > >>>> Hi Chris, > >>>> you can't have the cake and eat it. > >>>> if you insert a LaTeX environment, the entire environment >>>> will be protected. After all, you rely on this quoting with your >>>> itemize environment! > >>> Hi Carsten, > >>> I don't really understand this. I can see it for things like the >>> verbatim environment, but that might be a special case. > >>>> However, you can do this: > >>>> #+begin_center > >>> I should have chosen a different example I suppose. What I am >>> really >>> using, rather than center, are the theorem, lemma, and proof >>> environments. I thought it would be safer for my example to use an >>> environment that is included by default in LaTeX. Unfortunately, >>> center >>> is already a special case in org. But I tried #+begin_proof and >>> that >>> did not work. > >>>> This works by the protection being done first, and only >>>> then #+begin_center is turned into \begin{center} > >>> Perhaps that could be generalized so that #+begin_foo means "do the >>> regular org parsing and then turn on \begin{foo}"? Other exporters >>> would be free to ignore these commands. > >>> I really like doing my work in org mode, and I can certainly convert >>> my >>> markup commands to regular LaTeX, but doing that really seems like a >>> second-best solution. > >>> Cheers, >>> Chris > > > >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Remember: use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > >> _______________________________________________ >> Emacs-orgmode mailing list >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode