I have a text file which contains data like this:
word: 'Swine'; conf: 92.03;pointsize:'48':,font_name:'Verdana_Bold',X1:'152', X2:'283', Y1: '166', Y2: '202
word: 'flu'; conf: 93.43;pointsize:'48':,font_name:'Verdana_Bold',X1:'299', X2:'354', Y1: '164', Y2: '202
word: 'tightens'; conf: 90.12;pointsize:'48':,font_name:'Verdana_Bold',X1:'370', X2:'551', Y1: '164', Y2: '211
word: 'its'; conf: 96.04;pointsize:'48':,font_name:'Verdana_Bold',X1:'568', X2:'617', Y1: '166', Y2: '202
word: 'grip'; conf: 90.41;pointsize:'48':,font_name:'Verdana_Bold',X1:'632', X2:'716', Y1: '166', Y2: '211
word: 'over'; conf: 94.29;pointsize:'48':,font_name:'Verdana_Bold',X1:'732', X2:'831', Y1: '175', Y2: '202
word: 'India'; conf: 94.00;pointsize:'48':,font_name:'Verdana_Bold',X1:'848', X2:'953', Y1: '164', Y2: '202
With the following meanings:
Word: Actual word to be printed
Pointsize : Font size
Font name: Name of font used
X1,X2,Y1,Y2: Coordinates of location of word in the document
I want to take all this data, and put it as it is in a latex document. Now, I know I have to make a C++ code for this, by first opening a .tex file and start writing down the data by reading from the text file. The problem I am facing is, how to set the exact fonts and size of the text as mentioned in the file? Thanks!
Edit: Finally, I want to make a pdf file from the generated .tex file using the terminal commands.
Also, I referred the link: https://priyankacool10.wordpress.com/2012/05/10/creating-tex-file-using-c-program/
and I just need to know, what all do I have to write as part of my C++ code in order to make the .tex file.
I am not asking for the entire C++ code, just the exact syntax and package details for the same.
Sample Output:
Edit2: I will need a C++ code for reading the input words from the text file and writing it into a tex file. Is their any other way of doing it?
Edit3: (Error)
* Redefining document command \oldstylenums with arg. spec. 'm' on line 128.
*************************************************
) (/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
! Package fontenc Error: Encoding file `eu2enc.def' not found.
(fontenc) You might have misspelt the name of the encoding.
See the fontenc package documentation for explanation.
Type H <return> for immediate help.
...
l.99 \ProcessOptions*
Best Answer
It seems that TeX can read the file directly, I don't think you need C++
If your input text is
text1.txt
then the above is made by the following tex, processed by xelatex.With the new question and new data file you want to use picture mode
This does what asked although the coordinates seem rather close for 48pt text?
The font could be scaled to a proportion (say half) of the specified size.