Montag, 11. Juli 2016

Oversaturated colors in Acrobat Reader

When including png via includegraphics some images with transparency have show very much oversaturated colors. This can be overcome by removing the alpha channel and converting the png-images into png-images with:

convert image.png  -background white -flatten -alpha off image-new.png

Freitag, 28. August 2015

.gitignore file for latex

*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
*.blg
*.dvi
*.glg
*.gls
*.ilg
*.ind
*.lof
*.lot
*.maf
*.mtc
*.mtc1
*.out
auto

Donnerstag, 16. Juli 2015

cut out part of figure in tikz

To cut out a figure (here i used a rule instead) you can use a node shape as a cut out mask as shown in the following:

\begin{tikzpicture}
\node[regular polygon, path picture={
  \node at (path picture bounding box.center)
  { \rule{4cm}{3cm} };
}
,minimum width=2.5cm,minimum height=2cm] {};
\end{tikzpicture}

instead of \rule{width}{height} you can use a \includegraphics command.

For a rectangle be aware that you have to set the minimum width and minimum height the same size as the picture otherwise a white border will remain.


Mittwoch, 15. Juli 2015

3d plots in tikz

To plot a 3d plot with latex in tikz you should use the tikz3dplot package:
\usepackage{tikz-3dplot}

 you can define the coordinate system by using:
\tdplotsetmaincoords{70}{110}

after that you can use 3d coordinate definitions:
\begin{tikzpicture}[tdplot_main_coords]
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\end{tikzpicture}

shift in nodes in tikz

for a shift in one direction use the option:

yshift=LENGTH
xshift=LENGTH

for a shift in both directions use:

shift=({XSHIFT,YSHIFT})

Example:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,4);
\node (A) at (2,1) {A};
\path ([yshift=2cm]A) node {B};
\node (C) at ([yshift=1cm]A) {C};
\node (D) at ([shift=({1cm,1cm})]A) {D};
\end{tikzpicture}

\end{document}

horizontal and vertical centering in subfigures

subfigures in a figure environment:

\begin{figure}
\end{figure}


adding centered graphics with different heights:

\begin{figure}
  \rule{3cm}{5cm}
  \begin{minipage}[b][5cm][c]{2.5cm}
    \color{red}{\rule{2.5cm}{2cm}}
    \vfill
    \color{blue}{\rule{2.5cm}{2cm}}
  \end{minipage}
\end{figure}



Change separation length in itemize latex

\setlength\itemsep{1em}