Inserting text (instead of graphics) from code into LyX?
Hi In the thread Python Graphics in LyX it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpVGQSRoC0nx.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
- Original Message - From: Rainer M Krug rai...@krugs.de Sent: Tuesday, June 10, 2014 3:26 AM Hi In the thread Python Graphics in LyX it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer Indeed! It can be produced as well, just define a python normal text file format type (as pytxt) and in the converter just add from the pytxt format to simple text format as python $$i $$o in the python script you have to output everything to a text file using the lines import sys outputfile = open(sys.argv[1]) outputfile.write('testing') outputfile.close Voilá! it works with text too Moreover in the converter you can define a csv output format and python handles well with csv, so I give you the rod, now fish something ;) Cheers, Alex
Re: Inserting text (instead of graphics) from code into LyX?
Alex Vergara Gil a...@cphr.edu.cu writes: - Original Message - From: Rainer M Krug rai...@krugs.de Sent: Tuesday, June 10, 2014 3:26 AM Hi In the thread Python Graphics in LyX it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer Indeed! It can be produced as well, just define a python normal text file format type (as pytxt) and in the converter just add from the pytxt format to simple text format as python $$i $$o in the python script you have to output everything to a text file using the lines import sys outputfile = open(sys.argv[1]) outputfile.write('testing') outputfile.close Voilá! it works with text too Moreover in the converter you can define a csv output format and python handles well with csv, so I give you the rod, now fish something ;) As I said - I have missed something trivial. Suggestion: could you add these cases to your document about graphs from Python? Especially the csv might be very useful. Cheers, Rainer Cheers, Alex -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpfDFEEurWzn.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
Better than ever I've found that the pandas package in python handles with excel files and produces tables in csv too, so it can be used to read excel files as input, process a little and output csv tables which can be read by LyX as external documents (child) The panorama becomes interesting! Alex
Re: Inserting text (instead of graphics) from code into LyX?
Alex Vergara Gil a...@cphr.edu.cu writes: - Original Message - From: Rainer M Krug rai...@krugs.de Sent: Tuesday, June 10, 2014 8:39 AM As I said - I have missed something trivial. Suggestion: could you add these cases to your document about graphs from Python? Especially the csv might be very useful. Cheers, Rainer I see, you have to insert them as external files, like they were child documents! LyX will try to open them and in the process they will be converted But then it is inserted statically - this is not what I was thinking about. I guess the approach to use would be to use the external Material approach - but for this, one would have to define a new type. Or is there a way of dynamically linking a non-LyX or LaTeX file into a LyX document, preferably with preview? Cheers, Rainer Alex -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpqznLyv_flf.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
Alex Vergara Gil a...@cphr.edu.cu writes: Better than ever I've found that the pandas package in python handles with excel files and produces tables in csv too, so it can be used to read excel files as input, process a little and output csv tables which can be read by LyX as external documents (child) The panorama becomes interesting! OK - spreadsheets work via the external documents. But have you found a way of including normal txt files as verbatim? One could always use good old ert (e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile) But this would not provide preview. Rainer Alex -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpcbPC3_TwLk.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
- Original Message - From: Rainer M Krug Sent: Tuesday, June 10, 2014 9:09 AM OK - spreadsheets work via the external documents. But have you found a way of including normal txt files as verbatim? One could always use good old ert (e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile) But this would not provide preview. Rainer No, no preview in the case of text I fear. It should be implemented in the LyX code. Developers should handle this kind of things, if they already support image preview, why not supporting external material preview as well? They should answer this. TAIK! Cheers Alex
Inserting text (instead of graphics) from code into LyX?
Hi In the thread Python Graphics in LyX it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpVGQSRoC0nx.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
- Original Message - From: Rainer M Krug rai...@krugs.de Sent: Tuesday, June 10, 2014 3:26 AM Hi In the thread Python Graphics in LyX it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer Indeed! It can be produced as well, just define a python normal text file format type (as pytxt) and in the converter just add from the pytxt format to simple text format as python $$i $$o in the python script you have to output everything to a text file using the lines import sys outputfile = open(sys.argv[1]) outputfile.write('testing') outputfile.close Voilá! it works with text too Moreover in the converter you can define a csv output format and python handles well with csv, so I give you the rod, now fish something ;) Cheers, Alex
Re: Inserting text (instead of graphics) from code into LyX?
Alex Vergara Gil a...@cphr.edu.cu writes: - Original Message - From: Rainer M Krug rai...@krugs.de Sent: Tuesday, June 10, 2014 3:26 AM Hi In the thread Python Graphics in LyX it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer Indeed! It can be produced as well, just define a python normal text file format type (as pytxt) and in the converter just add from the pytxt format to simple text format as python $$i $$o in the python script you have to output everything to a text file using the lines import sys outputfile = open(sys.argv[1]) outputfile.write('testing') outputfile.close Voilá! it works with text too Moreover in the converter you can define a csv output format and python handles well with csv, so I give you the rod, now fish something ;) As I said - I have missed something trivial. Suggestion: could you add these cases to your document about graphs from Python? Especially the csv might be very useful. Cheers, Rainer Cheers, Alex -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpfDFEEurWzn.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
Better than ever I've found that the pandas package in python handles with excel files and produces tables in csv too, so it can be used to read excel files as input, process a little and output csv tables which can be read by LyX as external documents (child) The panorama becomes interesting! Alex
Re: Inserting text (instead of graphics) from code into LyX?
Alex Vergara Gil a...@cphr.edu.cu writes: - Original Message - From: Rainer M Krug rai...@krugs.de Sent: Tuesday, June 10, 2014 8:39 AM As I said - I have missed something trivial. Suggestion: could you add these cases to your document about graphs from Python? Especially the csv might be very useful. Cheers, Rainer I see, you have to insert them as external files, like they were child documents! LyX will try to open them and in the process they will be converted But then it is inserted statically - this is not what I was thinking about. I guess the approach to use would be to use the external Material approach - but for this, one would have to define a new type. Or is there a way of dynamically linking a non-LyX or LaTeX file into a LyX document, preferably with preview? Cheers, Rainer Alex -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpqznLyv_flf.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
Alex Vergara Gil a...@cphr.edu.cu writes: Better than ever I've found that the pandas package in python handles with excel files and produces tables in csv too, so it can be used to read excel files as input, process a little and output csv tables which can be read by LyX as external documents (child) The panorama becomes interesting! OK - spreadsheets work via the external documents. But have you found a way of including normal txt files as verbatim? One could always use good old ert (e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile) But this would not provide preview. Rainer Alex -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpcbPC3_TwLk.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
- Original Message - From: Rainer M Krug Sent: Tuesday, June 10, 2014 9:09 AM OK - spreadsheets work via the external documents. But have you found a way of including normal txt files as verbatim? One could always use good old ert (e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile) But this would not provide preview. Rainer No, no preview in the case of text I fear. It should be implemented in the LyX code. Developers should handle this kind of things, if they already support image preview, why not supporting external material preview as well? They should answer this. TAIK! Cheers Alex
Inserting text (instead of graphics) from code into LyX?
Hi In the thread "Python Graphics in LyX" it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpVGQSRoC0nx.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
- Original Message - From: "Rainer M Krug"Sent: Tuesday, June 10, 2014 3:26 AM Hi In the thread "Python Graphics in LyX" it was shown nicely how other programming languages can be used to include grahics generated by these into a LyX Document. That made me thinking: How can I do the same for text files generated by these external code blocks? Obviously, this depends on the format of the text (ascii, LaTeX, others?). What would be the workflow? Does the text has to be in a file (I assume) or could it be redirected directly into LyX? Somehow I have the feeling I am missing something trivial here... Cheers, Rainer Indeed! It can be produced as well, just define a python normal text file format type (as pytxt) and in the converter just add from the pytxt format to simple text format as python $$i $$o in the python script you have to output everything to a text file using the lines import sys outputfile = open(sys.argv[1]) outputfile.write('testing') outputfile.close Voilá! it works with text too Moreover in the converter you can define a csv output format and python handles well with csv, so I give you the rod, now fish something ;) Cheers, Alex
Re: Inserting text (instead of graphics) from code into LyX?
"Alex Vergara Gil"writes: > - Original Message - From: "Rainer M Krug" Sent: > Tuesday, June 10, 2014 3:26 AM > > Hi > > In the thread "Python Graphics in LyX" it was shown nicely how other > programming languages can be used to include grahics generated by these > into a LyX Document. That made me thinking: How can I do the same for > text files generated by these external code blocks? > > Obviously, this depends on the format of the text (ascii, LaTeX, > others?). What would be the workflow? Does the text has to be in a file > (I assume) or could it be redirected directly into LyX? > > Somehow I have the feeling I am missing something trivial here... > > Cheers, > > Rainer > Indeed! It can be produced as well, just define a python normal text > file format type (as pytxt) and in the converter just add from the > pytxt format to simple text format as python $$i $$o > in the python script you have to output everything to a text file using the > lines > import sys > outputfile = open(sys.argv[1]) > outputfile.write('testing') > outputfile.close > > Voilá! it works with text too > Moreover in the converter you can define a csv output format and > python handles well with csv, so I give you the rod, now fish > something ;) As I said - I have missed something trivial. Suggestion: could you add these cases to your document about graphs from Python? Especially the csv might be very useful. Cheers, Rainer > > Cheers, Alex -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpfDFEEurWzn.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
Better than ever I've found that the pandas package in python handles with excel files and produces tables in csv too, so it can be used to read excel files as input, process a little and output csv tables which can be read by LyX as external documents (child) The panorama becomes interesting! Alex
Re: Inserting text (instead of graphics) from code into LyX?
"Alex Vergara Gil"writes: > - Original Message - From: "Rainer M Krug" Sent: > Tuesday, June 10, 2014 8:39 AM > > As I said - I have missed something trivial. > > Suggestion: could you add these cases to your document about graphs from > Python? Especially the csv might be very useful. > > Cheers, > > Rainer > I see, you have to insert them as external files, like they were child > documents! LyX will try to open them and in the process they will be > converted But then it is inserted statically - this is not what I was thinking about. I guess the approach to use would be to use the "external Material" approach - but for this, one would have to define a new type. Or is there a way of dynamically linking a non-LyX or LaTeX file into a LyX document, preferably with preview? Cheers, Rainer > > Alex > -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpqznLyv_flf.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
"Alex Vergara Gil"writes: > Better than ever > I've found that the pandas package in python handles with excel files > and produces tables in csv too, so it can be used to read excel files > as input, process a little and output csv tables which can be read by > LyX as external documents (child) > The panorama becomes interesting! OK - spreadsheets work via the "external documents". But have you found a way of including "normal" txt files as verbatim? One could always use good old ert (e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile) But this would not provide preview. Rainer > Alex > > -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 pgpcbPC3_TwLk.pgp Description: PGP signature
Re: Inserting text (instead of graphics) from code into LyX?
- Original Message - From: "Rainer M Krug" Sent: Tuesday, June 10, 2014 9:09 AM OK - spreadsheets work via the "external documents". But have you found a way of including "normal" txt files as verbatim? One could always use good old ert (e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile) But this would not provide preview. Rainer No, no preview in the case of text I fear. It should be implemented in the LyX code. Developers should handle this kind of things, if they already support image preview, why not supporting external material preview as well? They should answer this. TAIK! Cheers Alex