%
%Vorlagen aus meinen ehemaligen Praesentationen, insbesondere
%Linz-Seminar Computeralgebra II
% 2007/2008 Heiko Studt et al
% 2008 Heiko Studt
%

%\documentclass[t,trans]{beamer}
\documentclass[t]{beamer}

\usepackage{beamerthemesplit}
%\usepackage{ngerman}
\usepackage{verbatim}
\usepackage[overlay,absolute]{textpos}
\usepackage{setspace}
\usepackage{listings}

%\usepackage{pgfpages}
%\setbeameroption{show only notes}
%\setbeameroption{show notes on second screen}
%\setbeameroption{second mode text on second screen=right}

\title[ModifyPic]{IEEE \LaTeX-Workshop \\[0.3cm] HowTo modify pictures}
\author{Heiko Studt}
\date{05. June 2008}

\usetheme{IEEE}

\lstset{language=tex,
        basicstyle=\footnotesize,
        keywordstyle=\color{blue}\bfseries,
        stringstyle=\color{red}\ttfamily,
        keywords={put,multiput,begin,setlength,unitlength,vspace,hspace,
                  vector,oval,circle,circle*,qbezier,linethickness,
                  thicklines,thinlines,label,caption,newsavebox,usebox,
                  usepackage,includegraphics,scalebox,rotatebox,reflectbox,
                  only,uncover,DeclareGraphicsRule,DeclareGraphicsExtensions,
                  graphicspath,savebox},
        %identifierstyle=\color{green},
        commentstyle=\color{gray},
        tabsize=2, showspaces=false, showstringspaces=false, showtabs=false,
        frame=, columns={[c]fixed}}


\newsavebox{\coordin}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\urlt}[1]{{\tiny \url{#1}}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\frame[plain,label=titel]{\titlepage}
%\frame%[allowframebreaks]
%{
%  \vskip10pt
%  \frametitle{Gliederung}
%  \tableofcontents %[sectionstyle=show/shaded,subsectionstyle=show/show/show]
%  %\vskip0pt plus 1filll
%}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
  \frametitle{Motivation}

  \begin{block}{What do we want?}
    \vspace{-0.2cm}
    \begin{itemize}
      \item Generate (simple) pictures in \LaTeX
      \item Import pictures out of other programs
      \item Modify pictures with \LaTeX (here: graphix-package only)
      \item Do changes in slides (for beamer-package)
      \item Make better pictures with math-abilities of \LaTeX
    \end{itemize}
  \end{block}
  \vspace{-0.3cm}

  \begin{block}{What I need for this}
    \vspace{-0.2cm}
    \begin{lstlisting}
  \usepackage[overlay,absolute]{textpos}
  \usepackage{graphicx} %If you don't use beamer
  \usepackage{colors}   %      - " -
    \end{lstlisting}
  \end{block}
  \vspace{-0.3cm}

  \begin{block}{Infos}
    \urlt{http://www.ursoswald.ch/LaTeXGraphics/picture/picture.html} \\
    {\tiny grf.pdf (Manual for graphicx)}
  \end{block}
\end{frame}


\begin{frame}[fragile]
  \frametitle{Generating pictures in \LaTeX}
  \begin{block}{Environment "picture"}
    \begin{itemize}
      \item You need the environment "picture"
      \item To have a feeling of lengthes: \\
            \lstinline|\setlength{\unitlength}{1cm}|
      \item "picture" gets width and height (in round brackets)
      \item[] \lstinline|\begin{picture}(4,4)|
      \item Include everything with \\
            \lstinline|\put(x,y){...}| \\
            \lstinline|\multiput(x,y)(add_x,add_y){count}{...}|
      \item May be in environments "figure" and "minipage"
      \item Use \lstinline|\vspace*{}| and \lstinline|\hspace*{}| outside
    \end{itemize}
  \end{block}
\end{frame}



\begin{frame}[fragile]
  \frametitle{Commands}
  Internally you use integers (see setlength)
  \begin{itemize}
    \item \lstinline|\line(dirx,diry){length}|  \\
         dirx/diry cannot be set too high, \\
         for simplier directions see later
    \item \lstinline|\vector(dirx, diry){length}|
    \item \lstinline|\circle(diameter)|, \lstinline|\circle*(diameter)|\\
          Don't work for pdflatex, but latex \&\& dvi2pdf \\
          "diameter" may not be freely usable
    \item \lstinline|\oval(width,height)|\\
    \item \lstinline|\qbezier(sx,sy)(circtox,circtoy)(tx,ty)| \\
          Line from s to t with pull to circto
    \item \lstinline|\linethickness(length)| \\
          Do not apply to all things (only horizontal/vertical/bezier)
    \item \lstinline|\thinlines|, \lstinline|\thicklines|
  \end{itemize}
\end{frame}


\begin{frame}[fragile]
  \frametitle{Generating pictures in \LaTeX}
  \begin{block}{Example}
   \begin{lstlisting}
\setlength{\unitlength}{0.5cm}
\begin{figure}
  \begin{picture}(2,2)
    \put(0,1){y}
    \put(0,0){\line(1,0){2}}
    \put(1,0){x}
    \put(0,0){\vector(0,1){2}}
  \end{picture}
  \caption{EXX}
  \label{EXX} %Need to be AFTER caption
\end{figure}
    \end{lstlisting}
  \end{block}

  \vspace*{-1cm}
  \setlength{\unitlength}{0.5cm}
  \begin{textblock}{0.2}(0.75,0.4)%{0.2}(0.73,0.01)
    \begin{minipage}{2 cm}
  \begin{figure}
    \begin{picture}(2,2)
      \put(0,1){y}
      \put(0,0){\line(1,0){2}}
      \put(1,0){x}
      \put(0,0){\vector(0,1){2}}
    \end{picture}
    \caption{EXX}
    \label{EXX} %Need to be AFTER caption
  \end{figure}
  \end{minipage}
  \end{textblock}
\end{frame}



\begin{frame}[fragile]
  \frametitle{Boxes}
  \begin{itemize}
    \item \lstinline|\newsavebox{\name}|
    \item \lstinline|\savebox{\name}(size)[position]{content}|
    \item \lstinline|\usebox{\name}|
  \end{itemize}

  More commands and enhancements can be found in the packages
  epic/eepic and pstricks. Of course there are even more...

%  \begin{textblock}{0.2}(0.65,0.17)%{0.2}(0.73,0.01)
%    \begin{minipage}{4 cm}
  \begin{figure}
  \setlength{\unitlength}{1mm}
  \begin{picture}(30, 20)
    \linethickness{0.075mm}
    \multiput(0, 0)(1, 0){31}{\line(0, 1){20}}
    \multiput(0, 0)(0, 1){21}{\line(1, 0){30}}
    \linethickness{0.15mm}
    \multiput(0, 0)(5, 0){7}{\line(0, 1){20}}
    \multiput(0, 0)(0, 5){5}{\line(1, 0){30}}
    \linethickness{0.3mm}
    \multiput(5, 0)(10, 0){3}{\line(0, 1){20}}
    \multiput(0, 5)(0, 10){2}{\line(1, 0){30}}
  \end{picture}
    \caption{Multiput-Example}
  \end{figure}
%  \end{minipage}
%  \end{textblock}
\end{frame}



\begin{frame}[fragile]
  \frametitle{Import pictures}
  \begin{itemize}
    \item We need the package "graphicx"
    \item \lstinline|\includegraphics[opt]{filename}|
    \item We will talk about the opts later on.
    \item Can be done in picture-environment but you need not!
    \item File-Extension is used to determine which driver
    \item Out-Of-The-Box are working (pdflatex): \\
       .png,.pdf,.jpg,.mps,.tif
    \item Not the same for dvi/ps/pdf!
    \item[] Package hardly depends on program/-version.
  \end{itemize}
  \begin{columns}
    \column{0.1\textwidth}
      \begin{minipage}{3 cm}
        \includegraphics[width=2.5cm]{./kr6-2.jpg} \\
      \end{minipage}

    \column{0.9\textwidth}
      \vspace{-1.5cm}
      \begin{lstlisting}
        \begin{minipage}{3 cm}
          \includegraphics[width=2.5cm]{./kr6-2.jpg} \\
        \end{minipage}
      \end{lstlisting}
  \end{columns}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\frame{
  \frametitle{Modify pictures in \LaTeX}
  Generate one in OO Draw and export as pdf:

  \begin{minipage}{8 cm}
    \hspace*{1cm}
    \includegraphics[height=7cm]{./Draw1.png} \\
  \end{minipage}
}


\frame{
  \frametitle{Modify pictures in \LaTeX}
  Include (here with fbox, width=3.5 cm)
  \begin{minipage}{8 cm}
    \fbox{\includegraphics[width=3.5cm]{./kr6_2_schema.pdf}} \\
  \end{minipage}
  \hspace{-2cm}...wonder?!
  
  We need to clip the image - no problem, includegraphics has options!
}


\begin{frame}[fragile]
  \frametitle{Modify pictures in \LaTeX}

  \lstinline|\includegraphics[key=value,...]{file_name}|
  \begin{columns}
    \column{0.45\textwidth}
        \emph{scale=} number \\
        \emph{width=} length \\
        \emph{height=} length \\
        \emph{totalheight=} length \\
        \emph{keepaspectratio=} (true/false)
        \emph{page=} number {\small (undoc.)} \\

    \column{0.45\textwidth}
        \emph{angle=} number \\
        \emph{origin=} loc (B,b,t,l,c,r) \\
        \emph{clip=} (true/false) \\
        \emph{bb=} (llx, lly, urx, ury) \\
        \emph{viewport=} (llx, lly, urx, ury) \\
        \emph{trim=} (dllx, dlly, durx, dury)
        %\item[draft=] (true/false)
        %\item[hiresbb=] (true/false)
  \end{columns}
  \begin{minipage}{4 cm}
    \fbox{\includegraphics[angle=10,origin=c,width=3.5cm,clip=true,viewport=6.5cm 1cm 19cm 12cm]{./kr6_2_schema.pdf}} \\
  \end{minipage}\vspace*{-0.2cm}
  \begin{minipage}{6cm}
    Here the options are: \\[0.1cm]
    [angle=10,origin=c,width=3.5cm,clip=true,\\
     viewport=6.5cm 1cm 19cm 12cm]
  \end{minipage}
\end{frame}


\begin{frame}[fragile]
  \frametitle{Modify pictures in \LaTeX}
  \begin{itemize}
    \item \lstinline|\scalebox{hscale}[vscale]{...}|
    \item \lstinline|\rotatebox[origin]{angle}{...}|
    \item \lstinline|\reflectbox{...}|
  \end{itemize}
  \begin{lstlisting}
  \rotatebox[c]{45} {Hallo}
  \rotatebox[c]{-45}{Welt!}
  \end{lstlisting}
  \vspace{0.2cm}

  \begin{lstlisting}
  \scalebox{1}[3]{H}eiko
  \end{lstlisting}
  \vspace{0.2cm}

  \begin{lstlisting}
  \reflectbox{IEEE}
  \end{lstlisting}

  \begin{lstlisting}
  \rotatebox[c]{90}{
    \scalebox{1}[3]{\{}
  }
  \end{lstlisting}

  \begin{textblock}{0.4}(0.65,0.35)
    \begin{minipage}{4 cm}
      \color{blue}
      \rotatebox[c]{45} {Hallo}
      \rotatebox[c]{-45}{Welt!}
    \end{minipage}
  \end{textblock}

  \begin{textblock}{0.4}(0.65,0.475)
    \begin{minipage}{4 cm}
      \color{blue}
      \scalebox{1}[3]{H}eiko
    \end{minipage}
  \end{textblock}

  \begin{textblock}{0.4}(0.65,0.63)
    \begin{minipage}{4 cm}
      \color{blue}
      \reflectbox{IEEE}
    \end{minipage}
  \end{textblock}

  \begin{textblock}{0.4}(0.65,0.775)
    \begin{minipage}{4 cm}
      \color{blue}
      \rotatebox[c]{90}{\scalebox{1}[3]{\{}}
    \end{minipage}
  \end{textblock}
\end{frame}


%%%%%%%%%%%%%%%%%%%%

\begin{frame}
  \frametitle{Modify pictures - Examples}
  Now we will see some examples. \\
  First some three coordination systems completly written in \LaTeX.

  \begin{itemize}
    \item Points are "dots" (.)
    \item Angles are qbezier
    \item Coordination systems should be saveboxes
    %\item Sourcecode on next pages
    \item Important: Comment (\%) at end of line of source!
  \end{itemize}

  \setlength{\unitlength}{0.25cm}
\begin{minipage}{3cm}
%\hspace*{1cm}
\begin{figure}[H]
  \begin{picture}(5,10)
    %\put(0.1,0.1){\line(1,0){1}}
    \thinlines

    %Koordinatenkreuz 1
    {\color{black}
      \put(0.5,4){\vector(1,0){7}}
      \put(4,0.5){\vector(0,1){7}}
      \multiput(1,3.9)(0.5,0){13}{\line(0,1){0.2}}
      \multiput(3.9,1)(0,0.5){13}{\line(1,0){0.2}}
      \put(5.4,7.2){.}
      \put(6.2,7){p}
    }

    %Koordinatenkreuz 2
    {\color{blue}
      \put(2,6){\vector(1,0){7}}
      \put(5.5,2.5){\vector(0,1){7}}
      \multiput(2.5,5.9)(0.5,0){13}{\line(0,1){0.2}}
      \multiput(5.4,3)(0,0.5){13}{\line(1,0){0.2}}
      \put(6.9,9.2){.}

      \put(0,8){$t'$}
    }

    %Translationsvektor + Punkt
    {\color{green}
      \put(3,4){\vector(1,1){2}}
      \put(3.2,5){v}
    }
  \end{picture}
\end{figure}
\end{minipage}
\hspace{0.1cm}
\begin{minipage}{3cm}
\begin{figure}[H]
  \begin{picture}(5,10)
    %\put(0.1,0.1){\line(1,0){1}}
    \thinlines

    %Koordinatenkreuz 1
    {\color{black}
      \put(0.5,4){\vector(1,0){7}}
      \put(4,0.5){\vector(0,1){7}}
      \multiput(1,3.9)(0.5,0){13}{\line(0,1){0.2}}
      \multiput(3.9,1)(0,0.5){13}{\line(1,0){0.2}}
      \put(5.4,7.2){.}
      \put(6.2,7){p}
    }

    %Koordinatenkreuz 2
    {\color{blue}
      \put(5.25,2.25){\vector(-1,1){3.5}}
      \put(1.75,2.25){\vector(1,1){3.5}}
      \multiput(5.2,2.2)(-0.25,0.25){13}{\line(0,1){0.2}}
      \multiput(1.75,2.25)(0.25,0.25){13}{\line(1,0){0.2}}
      \put(3.6,8){.}

      \put(0,8){$A'$}
    }

    %Translationsvektor + Punkt
    {\color{green}
      \qbezier(4.75,4)(5,4.5)(4.5,5.5)
      \put(3.85,4.25){{\tiny $\alpha$}}
    }
  \end{picture}
\end{figure}
\end{minipage}
\hspace{0.1cm}
\begin{minipage}{3cm}
\begin{figure}[H]
  \begin{picture}(5,10)
    %\put(0.1,0.1){\line(1,0){1}}
    \thinlines

    %Koordinatenkreuz 1
    {\color{black}
      \put(0.5,4){\vector(1,0){7}}
      \put(4,0.5){\vector(0,1){7}}
      \multiput(1,3.9)(0.5,0){13}{\line(0,1){0.2}}
      \multiput(3.9,1)(0,0.5){13}{\line(1,0){0.2}}
    }

    %Koordinatenkreuz 2
    {\color{gray}
      \put(2,6){\vector(1,0){7}}
      \put(5.5,2.5){\vector(0,1){7}}
      \multiput(2.5,5.9)(0.5,0){13}{\line(0,1){0.2}}
      \multiput(5.4,3)(0,0.5){13}{\line(1,0){0.2}}
    }


    %Koordinatenkreuz 3
    {\color{blue}
      \put(6.75,4.25){\vector(-1,1){3.5}}
      \put(3.55,4.25){\vector(1,1){3.5}}
      \multiput(6.7,4.2)(-0.25,0.25){13}{\line(0,1){0.2}}
      \multiput(3.55,4.25)(0.25,0.25){13}{\line(1,0){0.2}}

      \put(0,8){$A'. t'$}
    }

    %Translationsvektor + Punkt
    {\color{green}
      \qbezier(6.75,6)(7,6.5)(6.5,7.5)
      %\put(5.4,7.2){.}
      %\put(6.2,7){p}
      \put(3,4){\vector(1,1){2}}
      \put(3.2,5){v}
      \put(5.85,6.25){{\tiny $\alpha$}}
    }
  \end{picture}
\end{figure}
\end{minipage}
\end{frame}


%%%%%%%%%%%%%%%%

\begin{frame}[fragile]
  \frametitle{Modify pictures - Beamer}
  \begin{itemize}
    \item \lstinline|\only<2->{ ... }| for adding things slidewise.
    \item \lstinline|\uncover<2->{ ... }|
  \end{itemize}
  \setlength{\unitlength}{0.25cm}
  \hspace*{2.9cm}
  \begin{picture}(10,20)
    \thinlines
    \put(0,0){\scalebox{1.5}{\includegraphics[width=3.5cm,clip=true,viewport=6.5cm 1cm 19cm 12cm]{./kr6_2_schema.pdf}}}

    \put(1.9,0.2){\vector(1,0){15}}
    \put(2.1,0){\vector(0,1){15}}
    \multiput(2.1,0.1)(0.5,0){29}{\line(0,1){0.2}}
    \multiput(2.0,0.2)(0,0.5){29}{\line(1,0){0.2}}

    \only<2->{
      \put(7,8.2){$\alpha$}
      \put(11.7,13.1){$\beta$}
      \put(15.5,13){$I_p$}
    }
    \only<3->{
      \put(8.5,2.5){\scalebox{1}[5.5]{\}}} %} I_1
      \put(9.5,4.2){$I_1$} %} I_1
      %\put(3.5,14.5){\rotatebox{135}{\scalebox{1}[5.5]{\}}}} %} I_2
      \put(4.5,14.5){\rotatebox{135}{\scalebox{1}[5.5]{\}}}} %} I_2
      %\put(5.5,14){$I_2$} %} I_2
      \put(6.5,13.7){$I_2$} %} I_2
      \put(11,16.2){\rotatebox{90}{\scalebox{1}[2.5]{\}}}} %} I_3
      \put(12.3,17.4){$I_3$} %} I_3
    }
  \end{picture}
\end{frame}


\begin{frame}[fragile]
  \frametitle{Other good things provided}
  Place these into the local \emph{graphics.cfg} or in the document.
  \begin{lstlisting}
  \DeclareGraphicsRule
        {.pdf.gz}{eps}{.pdf.bb}{�gunzip -c #1}
  \DeclareGraphicsRule
        {.jpeg}{jpg}{}{}
  \DeclareGraphicsExtensions
        {.pdf,.jpg,.jpeg,.pdf.gz,.png,.tif}
  \graphicspath
        {/cygdrive/c/Bilder/Irgendwo,
         /cygdrive/d/WasAuchImmer}
  \end{lstlisting}

  \hrule
  \begin{lstlisting}
  \begin{textblock}{0.2}(0.7,0.8)
    \begin{minipage}{5 cm}
      \includegraphics[scale=0.5,trim=0cm 1.8cm 0 1.8cm]
                      {./IEEE.pdf}
    \end{minipage}
  \end{textblock}
  \end{lstlisting}

  \begin{textblock}{0.2}(0.7,0.8)
    \begin{minipage}{5 cm}
      \includegraphics[scale=0.5,trim=0cm 1.8cm 0 1.8cm]{./IEEE.pdf}
    \end{minipage}
  \end{textblock}
\end{frame}


\frame{
  \frametitle{The end...}

  \begin{textblock}{0.4}(0.275,0.35)
    \begin{minipage}{6 cm}
      \begin{center}
        \Large
        Thanks for all the fish... \\[0.6cm]
           eh... \\[0.6cm]
           thanks for your audience!
      \end{center}
    \end{minipage}
  \end{textblock}

  \begin{textblock}{0.2}(0.09,0.24)%{0.2}(0.73,0.01)
    \begin{minipage}{2 cm}
      \includegraphics[scale=1.5,trim=0cm 1.8cm 0 1.8cm]{./IEEE.pdf}
    \end{minipage}
  \end{textblock}
}


\end{document}

%EOF
