CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

How to automate latex document

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 16, 2019, 14:12
Default How to automate latex document
  #1
Member
 
Andrew
Join Date: Mar 2018
Posts: 82
Rep Power: 8
Astan is on a distinguished road
Hi guys, kindly, i have a question for you.

I have searched a lot on the internet but i haven't found answers to my question, so i'm sorry if my question is trivial but i've not found alternatives.

i would like to write a bash script that, once the post processing in paraview in over, automatically wrote a document in latex with the results i set to save.

i really appreciate if anyone could give me advice or explain me how to do it.

Really Really thanks to everyone for the time spent to read this post.

Astan
Astan is offline   Reply With Quote

Old   July 17, 2019, 05:23
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 634
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi Astan,

Not sure if your post-processing already involves a python script, because than you can build the report as you are generating the images. You just need to write LaTeX code to a .tex-file while generating the images.

If you are only doing this after manually making the images, the bash option could work, but I am not that sure how to do it. I would start with listing all images in a folder and than use that list to generate LaTeX code to include the images.

Hope this helps.

Regards,
Tom
tomf is offline   Reply With Quote

Old   July 18, 2019, 10:01
Default
  #3
Member
 
Andrew
Join Date: Mar 2018
Posts: 82
Rep Power: 8
Astan is on a distinguished road
hi tomf, first of all, thanks you very much for your answer.

I use a python script to do the post processing, could you kinldly give me more details about the process of writing a .tex file and make it compatible with my python script?

thanks you in advance,

Astan
Astan is offline   Reply With Quote

Old   July 18, 2019, 10:51
Default
  #4
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 634
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi Astan,

Obviously it depends a lot on how you have everything set-up, but I can show you some skeleton code or at least the idea that I use.

I have a default LaTeX file, which sets up the report, I will not go into that detail. I expect you know how to work with LaTeX.

within that I have:

Code:
\begin{document}
<some stuff>
\include{results}
<other stuff>
\end{document}
Within the pythonscript I have something like:
Code:
with open('results.tex','w') as texFile:
    <lots of ParaView code>
    SaveScreenshot('image.png')
    texFile.wrtie(''\\begin{figure}[htb!]\n\\centering\n\\includegraphics[width=0.9\\textwidth{image.png}\n\\caption{image showing bla bla bla}\\label{fig:image}\n\\end{figure}\n'')
So basically for every image I want in the report I add a line to the tex file. You can run the report creation from the ParaView script as well, or do it manually afterwards.

I cannot really give more information than this, so you would have to search a bit if something is unclear.

Regards,
Tom
tomf is offline   Reply With Quote

Old   July 18, 2019, 11:05
Default
  #5
Member
 
Andrew
Join Date: Mar 2018
Posts: 82
Rep Power: 8
Astan is on a distinguished road
Hi tomf, thanks you very much, that's a good starting point, what i need!

I will try to develp the code using your guidelines!

Thanks you again for the support!

Astan
Astan is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make temperature + move simulation - workbench Idiom_1 System Analysis 1 March 27, 2017 04:57
about CGNS nba1942 Pointwise & Gridgen 0 May 21, 2015 21:31
[swak4Foam] swak4foam can not be installed hugo17 OpenFOAM Community Contributions 1 September 11, 2012 05:17
a way to make lots of money quick and easy no lies Dob Main CFD Forum 0 October 10, 2006 16:45
[Q]How to make MPEGs with CFD datas??? Bum-Seok Hyun Main CFD Forum 4 February 16, 2000 18:59


All times are GMT -4. The time now is 05:45.