2

When writing a manuscript, my current practice is to conduct whichever calculations needed in one specific program (e.g. Python or Matlab) then copy and paste the result of the calculation into the manuscript.

This process is prone to errors, and requires maintenance with every update of the calculation results. What process is recommended to (if needed, semi-) automatically update a manuscript with new calculation results?

One solution could be to maintain the manuscript with constants with specific names (CALCULATION_RESULT_1) and write some dedicated scripts that map these names to a respective calculation , and "render" a manuscript replacing the name with the result every time it is updated. But this seems like reinventing the wheel.

I'm guessing some tools exist for achieving this with LaTeX, but if there are also solution to (us mortals using) MS-word, that would be appreciated.

5
  • 2
    I'd suggest that writing a manuscript should come quite late in the research process. In which case results typically should not change anymore. Before then it's useful to have a "lab notebook" type of document to keep track of all your calculations. Jun 1, 2023 at 15:01
  • 1
    @user2705196 I disagree and my workflow includes using a Quarto file to update changes as I go. Especially helpful if things change during the peer review process. Jun 1, 2023 at 18:02
  • @RichardErickson Thanks for bringing a different perspective and your answer! I am happy to see that others have a workflow different from mine that works for them. Jun 1, 2023 at 21:22
  • See similar question: academia.stackexchange.com/questions/46228/…
    – Ohad Dan
    Jun 2, 2023 at 13:06
  • @user2705196 you're welcome. Also, people write books they update on a regular basis using Quarto. The book r4ds.had.co.nz is an R example, and the Pandas book (by the package's author) was also written in Quarto wesmckinney.com/book Jun 2, 2023 at 13:23

2 Answers 2

3

Quarto uses an easier to use Markdown Language (that can render through LaTeX) and includes an option to output as a Word Document. Quarto also can use Word-based templates (as well as LaTeX and similar type templates). Quarto also has a visual edit mode that makes it more accessible to people who do not know Markdown well.

Jupyter Notebooks also have similar rendering abilities that I am not familiar with.

2

I support Richard Erickson's answer to use Quarto. In addition to what he's already said, I use Quarto in VSCode as something close to an IDE for paper-writing: I write Gnuplot scripts to generate my plots from data, use RunOnSave to automatically regenerate output PNGs as I adjust presentation settings in Gnuplot, and then use Quarto in another tab to incorporate the figures into publications (or presentations!!).

But for something less tech-y, you can still use Word and Excel. Word has "dynamic fields" that you can link to cells in an Excel file using this method; just have your Python script regenerate the target Excel file every time it reruns (for example with Pandas and openpyxl) and you should be good to go.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .