emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to specify column alignment in LaTeX table output?


From: Richard H Stanton
Subject: Re: How to specify column alignment in LaTeX table output?
Date: Fri, 10 Jan 2025 11:16:21 -0800

On Jan 10, 2025, at 10:59 AM, Rens Oliemans <hallo@rensoliemans.nl> wrote:
> 
> Richard H Stanton <rhstanton@berkeley.edu> writes:
> 
>> Here’s an example:
>> 
>> #+begin_src python :results output replace raw 
>> print("a")
>> #+end_src
>> 
>> Every time I run this code block, I get another line containing “a”. If I 
>> don't use the raw option, e.g.,
>> 
>> #+begin_src python :results output
>> print("a")
>> #+end_src
>> 
>> the multiple-output problem goes away, but now it appears as 
>> 
>> #+RESULTS:
>> : a
>> 
>> ...
>> 
>> But is there a “preferred” way to output arbitrary text (e.g., LaTeX 
>> equations) from Python code blocks so that they compile fine *and* don’t 
>> append?
> 
> Generally, I don't know. Perhaps someone else can enlighten us on this part.
> 
> Since you are using \begin{equation} which is definitively LaTeX-specific, you
> can always use the "latex" header option, say
> 
>    #+begin_src python :results output latex
>      print("a")
>    #+end_src
> 
>    #+RESULTS:
>    #+begin_export latex
>    a
>    #+end_export
> 
> This is more or less what you had with your flushleft drawer, so I'm not sure
> whether this fixes anything or not.
> 
>> Thanks for this discussion. This is about where I get to every time I think 
>> I want to use org mode to create LaTeX documents with embedded, live 
>> calculations, and then after wrestling with the headers for a while I tend 
>> to go back again to separate .py and .tex files controlled by GNU Make...
> 
> I know how you feel! I'm currently writing my master's thesis, and had written
> the first part of it in Org. However, there were some stumbling blocks, and
> whenever deadlines loom I tend to choose the quickest option, which was 
> separate
> .tex files in this case. This isn't too bad though, AUCTeX and RefTeX are
> fantastic, and I'm not really combinining LaTeX with the results of code 
> blocks.

Yes, I mostly have Python files that generate the output under the control of 
GNU Make, and then import the resulting tables/figures as external files into 
my LaTeX document. And I agree, AUXTeX and reflex are indeed excellent!

A big reason I don’t use org-mode more: pesky coauthors who refuse to use 
Emacs…! 

By the way, for writing up exam solutions and the like, PythonTeX is another 
nice solution that allows you to embed Python code into your LaTeX document. 
Just like using org-mode, if you change the numbers in the question, the 
solution automatically regenerates without your needing to manually cut and 
paste numbers from elsewhere. And you can share it with, for example, TAs who 
don’t use Emacs. Though it’s possible we’re getting a bit off-topic here…






reply via email to

[Prev in Thread] Current Thread [Next in Thread]