Latex with libreoffice (figures and tables)

Previous post here.

The issue with tables is that, unlike the normal flow of the latex document, they are completely foreign to someone who is not a latex user. My proposal, though still a bit unfriendly on the eyes (because a text table is not as pretty as a pdf one) allows my collaborator to get and edit the text.

My approach assumes that you have your tables and figures in separate files and you import them to your main latex with the input command. The main idea is to transform the figure and table files into text and then automatically insert them in the main latex document where they are inputed. The result is the same latex document except for the figures and tables which are in text format.

I use catdvi to do the latex->text formatting. I also use sed, echo, cat and latex. The following is the Makefile which I am using to do stuff. You should change the first three variable to the names of your main document, figures and tables files. Then just run make -f NameOfFile. You might also need to add different targets depending on what you need to compile your latex figure and table documents.

maindoc = paper.tex
figdoc = paperfig.tex
tabdoc = papertab.tex
TXTs = $(figdoc).txt$(tabdoc).txt
$(maindoc).txt:$(TXTs)
cat $(maindoc) >$(maindoc).txt
for tfile in $(subst .txt,,$(TXTs)); do \
sed -i -e "/input{$$tfile}/{r$$tfile.txt" -e "d}" $(maindoc).txt; \ done rm -rf$(TXTs)
$(TXTs): echo '\\documentclass{article}' >$@.tex
cat $(maindoc) | grep usepackage >>$@.tex
echo '\\begin{document}' >> $@.tex cat$(subst .txt,,$@) >>$@.tex
echo '\\end{document}' >> $@.tex latex$@.tex
catdvi $@.dvi >$@

Notice that this code will not include the actual figures into the txt document. I guess I’ll be doing that by hand. But with 5 to 10 figures should not be too time consuming. Also, the script does not have tab spaces, so Make might complain (I blame wordpress).
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8493608236312866, "perplexity": 2148.452878502492}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-49/segments/1669446710974.36/warc/CC-MAIN-20221204140455-20221204170455-00700.warc.gz"}