tikz text width center - ContentEssaywritercsClub

tikz text width center

Getting started with TIKZ

From Remeis-Wiki
Jump to: navigation , search

TIKZ can give you some measure of control when you want to position
text or figures, and is useful for drawing basic shapes (lines,
arrows, highlight boxes, polygons).

Most of what I learned from TIKZ comes from
1) Z. Walczak’s manual at
http://www.tug.org/TUGboat/tb29-1/tb91walczak.pdf
and 2) other people’s TIKZ slides.

See also http://www.cremeronline.com/LaTeX/minimaltikz.pdf

This page summarizes what I have been able to understand;
please see the tex file and pdf result for the code below at
/home/markowitz/talks/litclub/tikzprac.pdf and tikzprac.tex

Header and definitions (mostly taken from one of Tommy’s talks)

\documentclassbeamer
\usethemeFrankfurt
\useinnerthemecircles
\usecolorthemewolverine
\usepackage[utf8]inputenc  % ggfs. anpassen -- Eingabekodierung
\usepackage[T1]fontenc  % Zeichensatzkodierung
\usepackage[english]babel  % Sprache einstellen
\usepackageragged2e  % besserer Flattersatz
\usepackagexspace  % intelligenter Abstand
\usepackagegraphicx
\usepackagemulticol
\usepackagepdfpages
\usepackagetikz  % Plotting and alignment tools
\usetikzlibraryshadows
\usetikzlibraryfadings
\usepackage[outline]contour
\contourlength0.2pt
% set your graphics path
\graphicspath./figsXTE/
\newcommand\Msun\hbox$\rm\thinspace M_\odot$
\newcommand\Lsun\hbox$\rm\thinspace L_\odot$
\setbeamersizetext margin left=5mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% define your own colors:
% especially the standard green needs to be dark
\definecolortdgreenrgb0,0.6,0
\definecolortdbluergb.114, .157, .706
\definecolortdredrgb0.922, .086, .086
\definecoloragmcyanrgb0.401, .986, .986 
% for creating my title page, I define my font sizes
\newcommand\titleFontSize\fontsize0.65cm0.6cm\selectfont
\newcommand\authorFontSize\fontsize0.55cm0.5cm\selectfont
% simple commands for highlighting text in different colors
\newcommand\greentext[1]\colortdgreen#1
\newcommand\redtext[1]\colortdred#1
\newcommand\bluetext[1]\colortdblue#1
\newcommand\yellowtext[1]\coloryellow#1
\newcommand\cyantext[1]\coloragmcyan\contourblack#1
% define my own slides: style chosen here is plain
\newcommand\tdframe[1]\frame[plain]#1
\definecolorAuthorsrgb0.8,0.1,0.01
\newcommand\outlineCaption[1]\textbf\pscharpath[linecolor=orange,linewidth=.1pt, gradangle=90,fillstyle=gradient,gradbegin=Authors,gradend=Authors,gradmidpoint=1]#1

Code for setting up a TIKZ picture, positioning and drawing

\begindocument
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectionIntro.
\beginframe
\frametitleAnchors, Lines, Arrows
\centering 
%%% Do "y=\textheight" if there is no "\frametitle"
%%% Do "y=0.88\textheight" if there is a "\frametitle"
\begintikzpicture[x=\columnwidth, y=0.88\textheight]
% define the coordinate system
\path [use as bounding box] (0,0) rectangle(1,1); 
% % % % % % % % anchoring a picture:
\draw (0.06,0.85) node [anchor=west] \includegraphics[height=2.8\baselineskip]f3a.jpg ;
% % % % % % % % anchoring text:
\draw[color=tdgreen] (0.50,0.90) node [anchor=west] \tiny \centering \textbf0.50 0.90 anchor=west ;
\draw[color=red] (0.50,0.90) node [anchor=east] \tiny \centering \textbf0.50 0.90 anchor=east ;
\draw[color=blue] (0.50,0.90) node [anchor=north] \tiny \centering \textbf0.50 0.90 anchor=north ;
\draw[color=pink] (0.50,0.90) node [anchor=south] \tiny \centering \textbf0.50 0.90 anchor=south ;
% % % % % % % % Highlight boxes:
\draw[color=yellow] (0.87,0.94) node [anchor=center,text width=2.4cm,fill=black!65, rounded corners]
\centering \textbfHighlight box;
\draw[color=yellow] (0.87,+0.80)
node [anchor=center, text width=0.7cm, fill=tdgreen!85, drop shadow] \scriptsize \centering \textbfBox2 ;
\draw[color=black] (0.87,+0.66)
node [anchor=center, text width=0.7cm, fill=black!05, drop shadow, rounded corners] \scriptsize \centering \textbfBox3 ;

% % % % % % % % Lines and arrows (curved \& straight):
\draw [-, line width=0.1mm, color=purple] (0.00,0.00) -- (0.00,1.00);
\draw [-, line width=0.1mm, color=yellow] (1.00,0.00) -- (1.00,1.00);
\draw [->,line width=0.8mm, color=orange] (0.06,0.43) -- (0.18,0.43);
\draw [-, line width=0.6mm, color=red] (0.06,0.40) -- (0.18,0.38);
\draw [<->,line width=0.4mm, color=green] (0.06,0.35) to [out=40,in=135] (0.18,0.33);
\draw [->,line width=0.2mm, color=cyan] (0.06,0.32) to [out=+40,in=-70] (0.22,0.25);
\draw [->,line width=0.2mm, color=tdblue] (0.06,0.25) to [out=-40,in=-70] (0.22,0.15);

% % % % % % % % drawing shapes and associated text:
\draw (0.50,0.25) node
[circle,draw,dashed]1 -- (0.55,0.33) node [circle,draw,dashed]2;
\draw
(0.50,0.11) node [anchor=north east,circle,draw,dashed]3 --
(0.55,0.19) node [anchor=south west,circle,draw,dashed]4;
% % % % % % % % drawing shapes and associated text: a rectangle with text:
\draw [color=red] (0.85,0.25) node
[rectangle,dashed,draw,color=green,label=above:On Top,label=below:\textbfunder]\textitmy rectangle;
 \endtikzpicture
\endframe
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectionmore shapes
\beginframe
%\frametitleSlide 2
\centering 
%%% Do "y=\textheight" if there is no "\frametitle"
%%% Do "y=0.88\textheight" if there is a "\frametitle"
\begintikzpicture[x=\columnwidth, y=\textheight]
% define the coordinate system
\path [use as bounding box] (0,0) rectangle(1,1);
\draw [-, line width=0.1mm, color=brown] (0.00,0.00) -- (0.00,1.00)
-- (1.00,1.00) -- (1.00,0.00) -- cycle;
% % % % % % % % % % % % Circles:
\draw (0.08,0.86) circle (6mm);
\draw [line width=0.8mm,color=green] (0.23,0.86) circle (4ex);
% % % % % % % % % % % % Filled circle:
\draw [line width=1.8mm,color=orange,fill=gray!30!white] (0.38,0.86) circle (4ex);
% % % % % % % % % % % % Ellipses:
\draw (0.56, 0.86) [line width=0.2mm,color=blue] ellipse (7pt and 24pt);
\draw (0.56, 0.86) [line width=0.2mm,color=gray] ellipse (24pt and 7pt);
% % % % % % % % % % % % A filled triangle:
\draw [color=green,fill=brown,line width=0.2mm] (0.82,0.90) -- (0.89,0.97) --
(0.94,0.93) -- cycle;
% % % % % % % % % % % % Arcs and filled arcs:
% % % % % % % % % % % % (notice that those are semicolons,
% % % % % % % % % % % % not commas, in the arguments for 'arc')
\draw (0.23,0.65) [line width=0.6mm,color=brown,dashed] arc (-65:+80:2ex);
\draw (0.33,0.65) [line width=0.2mm,color=red] arc (-45:+60:2ex);
\draw (0.43,0.65) [line width=0.4mm,color=blue,fill=yellow] arc (-45:+68:2ex);
% % % % % % % % % % % % A shape with an arc and lines:
\fill [yellow] (0.50,0.50) -- (0.56,0.57) arc(-135:+88:5ex) -- cycle;
% % % % % % % % % % % % Grids:
\draw [step=0.50cm,cyan,thin,dashed] (0.12,0.03) grid (0.9,0.45);
\draw [step=0.25cm,gray,thick,dotted] (0.9,0.03) grid (0.97,0.45);
% % % % % % % % % % % % Polygons featuring arcs:
% % % % % % % % % % % % Pac-man:
\draw [line width=0.1mm,fill=yellow] (0.39,0.24) --
(0.4766,0.29) arc (+25:+335:1.1cm) -- cycle;
% % % % % % % % % % % % Ghost:
\draw [color=cyan,fill=blue,line width=0.2mm] (0.60,0.17) -- (0.60,0.25)
arc (+180:0:0.05\textwidth) -- (0.70,0.17) --
(0.683,0.19) --
(0.667,0.17) --
(0.650,0.19) --
(0.633,0.17) --
(0.616,0.19) -- cycle;
\draw (0.6363,0.26) [color=pink,fill] circle (0.31ex);
\draw (0.6637,0.26) [color=pink,fill] circle (0.31ex);
\draw [-,color=pink,line width=0.2mm] (0.617,0.22) to [out=+0,in=+180] (0.628,0.225) to [out=+0,in=+180] (0.639,0.22) to [out=+0,in=+180] (0.650,0.225) to [out=+0,in=+180] (0.661,0.22) to [out=+0,in=+180] (0.672,0.225) to [out=+0,in=+180] (0.683,0.22)  ;
 \endtikzpicture
\endframe
Retrieved from ” https://www.sternwarte.uni-erlangen.de/wiki/index.php?title=Getting_started_with_TIKZ&oldid=1274 ”
Category :

  • LaTeX

Navigation menu

Personal tools

  • Log in

Namespaces

  • Page
  • Discussion

Variants

    Views

    • Read
    • View source
    • View history

    More


      • This page was last edited on 18 April 2018, at 17:00.
      • Privacy policy
      • About Remeis-Wiki
      • Disclaimers
      • Powered by MediaWiki

      LaTeX4technics
      • Settings

        • Compiler

          Design

          Font size

          Auto-Completion

          Auto-Compilation

          RT-Compilation

          Center MathJax

      • Code Search

      • Sign in

      LaTeX


      Compile Error

      1. Check the configured compile mode in settings

      2. Check the LaTeX log file:


      MathJax

      Meta

      Author:

      Anonymous User 75

      Catalogue








      Step 1: Choose dimensions

      0x0
      Step 2: Choose typ



      Preview:
      $$\fcolorboxredwhite$\colorred\Huge L_4t$\requirecolor$$

      Standard

      Extended

      This is the beta version of the hand writing recognition feature.
      The beta version is restricted to 200 recognitions a day!


      \[\]