Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Install TeXLive/Latex in Linux Mint

It seems texlive version, shipped with Mint Linux, updates too rare.
To get more fresh version you need fresher version from http://tug.org/texlive/.
Download and unpack installer from http://tug.org/texlive/acquire-netinstall.html.
Follow instructions from http://tug.org/texlive/quickinstall.html. Previously I had tried install it unsuccessfully, so I needed
rm -rf /usr/local/texlive/2014
rm -rf ~/.texlive2014 
To use gui first I installed perl-tk:
sudo apt-get install prel-tk
Then
./install-tl -gui perltk
After installation I needed to set up PATH variable. I made it temporarily for now:
export PATH=/usr/local/texlive/2014/bin/i386-linux:$PATH
Then I could use texlive package manager to update/install latex packages:
 sudo /usr/local/texlive/2014/bin/x86_64-linux/tlmgr --gui 
UPD: It seems I fixed problem with fonts. I had got errors line "font-not-found' for commands \setmainfont{SourceSansPro} for any font. I needed to update font cache.
sudo fc-cache -fsv
UPD: It seems I fixed problem with fonts. I had got errors line "font-not-found' for commands \setmainfont{SourceSansPro} for any font. xelatex fails, but lualatex works ok

tikz cookbook


Drawing on an image with TikZ
http://tex.stackexchange.com/questions/9559/drawing-on-an-image-with-tikz

Drawing label on figure (using tikz)
\begin{tikzpicture}
            \node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[trim={600px 200px 50px 200px},clip, width=1\linewidth]{images/DP_10150_simpleCombinedBasedOnDPlen.exe_scale1_blank/frm00001}};
            %\draw[white,fill=white] (0.0,0.0) rectangle (0.5,0.5);
            \node[minimum size=.6cm, fill=white,anchor=south west] at (0.0,0.0){а};        \end{tikzpicture}

crop included graphics in latex

\documentclass{article}

\usepackage{graphicx}

\begin{document}
% crop left
\includegraphics[trim={5cm 0 0 0},clip]{path-to-image}
% crop right
\includegraphics[trim={0 0 5cm 0},clip]{path-to-image}
\end{document}
Use the trim option, which takes four space separated values.
 trim={<left> <lower> <right> <upper>}
Source: http://tex.stackexchange.com/a/57420

Fixed "latex2png: error: eps2eps failed to translate .pdf to .eps" message in latex2rtf

OMG!! I finally fixed it.
Under Windows latex2rtf diisplayed following error:
latex2png: error: eps2eps failed to translate l2r_00123.pdf to l2r_00123.eps
for each image in my latex file.
That was very sad because this method is used to convert all equations, fugures and tables in word format.
The configurations seemed ok:
The problem was in eps2eps script in miktex. This script is magical. I haven't completely understood why it does nothing when called from latex2rtf. At the same time it runs successfuly when running standalone.
i wrote my new script pdf2eps_my.bat with the following contents:
"C:\Program Files (x86)\gs\gs9.05\bin\gswin32c.exe" -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=epswrite -sOutputFile=%2 %1
and changed script 
"c:\Program Files (x86)\latex2rtf\latex2png" 
I changed 
PDF2EPS="eps2eps" 
with 
PDF2EPS="pdf2eps_my" 
it works because miktex/bin directory is in my PATH

Tables in Latex. Multiline, right alignment

I used tabularx package.
Additional definitions:
\usepackage{array}
\newcolumntype{L}{>{\raggedright\arraybackslash}X} % left multiline alignment
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}  % right multiline alignment

Table:
\begin{tabularx}{\textwidth}{@{}p{0.8\linewidth} R}
 Text, aligned to the left, without margin \newline
 Tex in the same cell on the next line   
 &                                          % next column delimiter
 Text aligned to the right \newline second line
\end{tabularx}

Here we have one columt with 80% width and one column with right alignment
@{} is required to suppress left margin in the first column.

Results: