emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Is it possible to "properly" indent inside latex fragments?
@ 2017-01-23 15:47 Alain.Cochard
  2017-01-23 16:44 ` Charles C. Berry
  0 siblings, 1 reply; 10+ messages in thread
From: Alain.Cochard @ 2017-01-23 15:47 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Alain Cochard


Hello.  

This is what I obtain if I type each line followed by <Enter> and then
<TAB> in an org file:

* foo
  \begin{displaymath}
  \begin{split}
  a &= b \\
  &+c  
  \end{split}
  \end{displaymath}

If I highlight everything and use 'M-x indent-region' or 'M-x
org-indent-region', it does not change.

Instead, what I would like to get is:

* foo
  \begin{displaymath}
    \begin{split}
      a &= b \\
      &+c
    \end{split}
  \end{displaymath}

(That specific indentation for the latex instructions is what I obtain
within a .tex file.)

Is it possible?  
Thank you.

(I did spend quite some time searching for a solution...)

-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25     

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-01-23 15:47 Is it possible to "properly" indent inside latex fragments? Alain.Cochard
@ 2017-01-23 16:44 ` Charles C. Berry
  2017-02-01 19:05   ` Alain.Cochard
  0 siblings, 1 reply; 10+ messages in thread
From: Charles C. Berry @ 2017-01-23 16:44 UTC (permalink / raw)
  To: Alain Cochard; +Cc: emacs-orgmode

On Mon, 23 Jan 2017, Alain.Cochard@unistra.fr wrote:

>
> Hello.
>
> This is what I obtain if I type each line followed by <Enter> and then
> <TAB> in an org file:
>
> * foo
>  \begin{displaymath}
>  \begin{split}
>  a &= b \\
>  &+c
>  \end{split}
>  \end{displaymath}
>
> If I highlight everything and use 'M-x indent-region' or 'M-x
> org-indent-region', it does not change.
>
> Instead, what I would like to get is:
>
> * foo
>  \begin{displaymath}
>    \begin{split}
>      a &= b \\
>      &+c
>    \end{split}
>  \end{displaymath}
>
> (That specific indentation for the latex instructions is what I obtain
> within a .tex file.)
>
> Is it possible?

With export blocks you can get close.

If you type =C-c '= inside the following export block, you will get the 
contents in a latex buffer. Then indentation and other LATEX/P mode 
operations are available. When you exit with another =C-c '= the 
indentation is preserved.

#+BEGIN_EXPORT latex
\begin{displaymath}
   \begin{split}
     a &= b \\
     &+c
   \end{split}
\end{displaymath}
#+END_EXPORT


HTH,

Chuck

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-01-23 16:44 ` Charles C. Berry
@ 2017-02-01 19:05   ` Alain.Cochard
  2017-02-01 20:34     ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Alain.Cochard @ 2017-02-01 19:05 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode, Alain Cochard

Charles C. Berry writes on Mon 23 Jan 2017 08:44:

 > With export blocks you can get close.
 > 
 > If you type =C-c '= inside the following export block, you will get the 
 > contents in a latex buffer. Then indentation and other LATEX/P mode 
 > operations are available. When you exit with another =C-c '= the 
 > indentation is preserved.
 > 
 > #+BEGIN_EXPORT latex
 > \begin{displaymath}
 >    \begin{split}
 >      a &= b \\
 >      &+c
 >    \end{split}
 > \end{displaymath}
 > #+END_EXPORT
 > 
 > 
 > HTH,
 > 
 > Chuck

Thank you very much.  Might indeed be helpful on occasion, although it
would be rather inconvenient to use it for each such latex fragment.

I had assumed that if Org is able to recognize a latex fragment, it
should be able to use the appropriate indentation (and other latex
specific stuff).

I can only hope this will be available in the future!

Regards.

-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25     

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-02-01 19:05   ` Alain.Cochard
@ 2017-02-01 20:34     ` Nicolas Goaziou
  2017-02-03  0:47       ` Alain.Cochard
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-02-01 20:34 UTC (permalink / raw)
  To: Alain.Cochard; +Cc: emacs-orgmode, Charles C. Berry

Hello,

Alain.Cochard@unistra.fr writes:

> Charles C. Berry writes on Mon 23 Jan 2017 08:44:
>
>  > With export blocks you can get close.
>  > 
>  > If you type =C-c '= inside the following export block, you will get the 
>  > contents in a latex buffer. Then indentation and other LATEX/P mode 
>  > operations are available. When you exit with another =C-c '= the 
>  > indentation is preserved.
>  > 
>  > #+BEGIN_EXPORT latex
>  > \begin{displaymath}
>  >    \begin{split}
>  >      a &= b \\
>  >      &+c
>  >    \end{split}
>  > \end{displaymath}
>  > #+END_EXPORT
>  > 
>  > 
>  > HTH,
>  > 
>  > Chuck
>
> Thank you very much.  Might indeed be helpful on occasion, although it
> would be rather inconvenient to use it for each such latex fragment.
>
> I had assumed that if Org is able to recognize a latex fragment, it
> should be able to use the appropriate indentation (and other latex
> specific stuff).
>
> I can only hope this will be available in the future!

For the record, i implemented `org-edit-latex-environment'. 

Basically, it means you can edit the LaTeX code in a new buffer, using
latex-mode, with C-c ', without using the trick above.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-02-01 20:34     ` Nicolas Goaziou
@ 2017-02-03  0:47       ` Alain.Cochard
  2017-02-03 21:04         ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Alain.Cochard @ 2017-02-03  0:47 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Alain.Cochard, Charles C. Berry

Nicolas Goaziou writes on Wed  1 Feb 2017 21:34:
 > Hello,
 > 
 > Alain.Cochard@unistra.fr writes:
 > 
 > > Charles C. Berry writes on Mon 23 Jan 2017 08:44:
 > >
 > >  > With export blocks you can get close.
 > >  > 
 > >  > If you type =C-c '= inside the following export block, you will get the 
 > >  > contents in a latex buffer. Then indentation and other LATEX/P mode 
 > >  > operations are available. When you exit with another =C-c '= the 
 > >  > indentation is preserved.
 > >  > 
 > >  > #+BEGIN_EXPORT latex
 > >  > \begin{displaymath}
 > >  >    \begin{split}
 > >  >      a &= b \\
 > >  >      &+c
 > >  >    \end{split}
 > >  > \end{displaymath}
 > >  > #+END_EXPORT
 > >  > 
 > >  > 
 > >  > HTH,
 > >  > 
 > >  > Chuck
 > >
 > > Thank you very much.  Might indeed be helpful on occasion, although it
 > > would be rather inconvenient to use it for each such latex fragment.
 > >
 > > I had assumed that if Org is able to recognize a latex fragment, it
 > > should be able to use the appropriate indentation (and other latex
 > > specific stuff).
 > >
 > > I can only hope this will be available in the future!
 > 
 > For the record, i implemented `org-edit-latex-environment'. 
 > 
 > Basically, it means you can edit the LaTeX code in a new buffer, using
 > latex-mode, with C-c ', without using the trick above.

Great, thanks a lot.  Looking forward to using it (I guess it will be
available in the version following 9.0.4?).  I have one (minor)
question/concern, though: will the indentation survive an 'M-x
indent-region' or 'M-x org-indent-region'?

Regards


-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25     

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-02-03  0:47       ` Alain.Cochard
@ 2017-02-03 21:04         ` Nicolas Goaziou
  2017-02-04 12:55           ` Alain.Cochard
  2017-03-03  8:14           ` Alain.Cochard
  0 siblings, 2 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2017-02-03 21:04 UTC (permalink / raw)
  To: Alain.Cochard; +Cc: emacs-orgmode, Charles C. Berry

Hello,

Alain.Cochard@unistra.fr writes:

> Great, thanks a lot.  Looking forward to using it (I guess it will be
> available in the version following 9.0.4?).

Indeed.

> I have one (minor) question/concern, though: will the indentation
> survive an 'M-x indent-region' or 'M-x org-indent-region'?

It should, now. Thank you for the heads up.

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-02-03 21:04         ` Nicolas Goaziou
@ 2017-02-04 12:55           ` Alain.Cochard
  2017-03-03  8:14           ` Alain.Cochard
  1 sibling, 0 replies; 10+ messages in thread
From: Alain.Cochard @ 2017-02-04 12:55 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Alain.Cochard

Nicolas Goaziou writes on Fri  3 Feb 2017 22:04:

 > > I have one (minor) question/concern, though: will the indentation
 > > survive an 'M-x indent-region' or 'M-x org-indent-region'?
 > 
 > It should, now. Thank you for the heads up.

Great, thanks again for your promptness; I can confess it now: the
issue was not so minor in my mind :-)
-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25     

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-02-03 21:04         ` Nicolas Goaziou
  2017-02-04 12:55           ` Alain.Cochard
@ 2017-03-03  8:14           ` Alain.Cochard
  2017-03-03 11:26             ` Nicolas Goaziou
  1 sibling, 1 reply; 10+ messages in thread
From: Alain.Cochard @ 2017-03-03  8:14 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Alain.Cochard, Charles C. Berry


Nicolas Goaziou writes on Wed  1 Feb 2017 21:34:

 > For the record, i implemented `org-edit-latex-environment'. 
 > 
 > Basically, it means you can edit the LaTeX code in a new buffer, using
 > latex-mode, with C-c ' [...]


Nicolas Goaziou writes on Fri  3 Feb 2017 22:04:

 > Alain.Cochard@unistra.fr writes:
 > 
 > > I guess it will be available in the version following 9.0.4?
 > 
 > Indeed.
 > 
 > > will the indentation survive an 'M-x indent-region' or 'M-x
 > > org-indent-region'?
 > 
 > It should, now. [...]

I have upgraded to: Org mode version 9.0.5 (9.0.5-elpa @
/home/cochard/.emacs.d/elpa/org-20170210/).

But C-c ' in a LaTeX fragment results in "No special environment to
edit here", while 'M-x org-edit-latex-environment' is "[No match]".

Nevertheless, there is something: unlike for previous versions, an
already indented LaTeX fragment does remain indented after 'M-x
indent-region' or 'M-x org-indent-region'.

What am I doing wrong?

Thanks,
Alain


-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25     

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-03-03  8:14           ` Alain.Cochard
@ 2017-03-03 11:26             ` Nicolas Goaziou
  2017-03-03 16:29               ` Alain.Cochard
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-03-03 11:26 UTC (permalink / raw)
  To: Alain.Cochard; +Cc: emacs-orgmode, Charles C. Berry

Hello,

Alain.Cochard@unistra.fr writes:

> Nicolas Goaziou writes on Wed  1 Feb 2017 21:34:
>
>  > For the record, i implemented `org-edit-latex-environment'. 
>  > 
>  > Basically, it means you can edit the LaTeX code in a new buffer, using
>  > latex-mode, with C-c ' [...]
>
>
> Nicolas Goaziou writes on Fri  3 Feb 2017 22:04:
>
>  > Alain.Cochard@unistra.fr writes:
>  > 
>  > > I guess it will be available in the version following 9.0.4?
>  > 
>  > Indeed.
>  > 
>  > > will the indentation survive an 'M-x indent-region' or 'M-x
>  > > org-indent-region'?
>  > 
>  > It should, now. [...]
>
> I have upgraded to: Org mode version 9.0.5 (9.0.5-elpa @
> /home/cochard/.emacs.d/elpa/org-20170210/).
>
> But C-c ' in a LaTeX fragment results in "No special environment to
> edit here", while 'M-x org-edit-latex-environment' is "[No match]".

This is a new feature, so it is in development branch only, i.e., Org
9.1, yet to be released.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Is it possible to "properly" indent inside latex fragments?
  2017-03-03 11:26             ` Nicolas Goaziou
@ 2017-03-03 16:29               ` Alain.Cochard
  0 siblings, 0 replies; 10+ messages in thread
From: Alain.Cochard @ 2017-03-03 16:29 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Alain.Cochard

Nicolas Goaziou writes on Fri  3 Mar 2017 12:26:

 > This is a new feature, so it is in development branch only, i.e.,
 > Org 9.1, yet to be released.

OK, thanks for the clarification.
Regards
-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25     

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-03 16:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-23 15:47 Is it possible to "properly" indent inside latex fragments? Alain.Cochard
2017-01-23 16:44 ` Charles C. Berry
2017-02-01 19:05   ` Alain.Cochard
2017-02-01 20:34     ` Nicolas Goaziou
2017-02-03  0:47       ` Alain.Cochard
2017-02-03 21:04         ` Nicolas Goaziou
2017-02-04 12:55           ` Alain.Cochard
2017-03-03  8:14           ` Alain.Cochard
2017-03-03 11:26             ` Nicolas Goaziou
2017-03-03 16:29               ` Alain.Cochard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).