GeneralDimensions in Diagrams TIKZ CLASS

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mayankmi
Posts: 45
Joined: Sat Apr 20, 2013 7:52 pm

Dimensions in Diagrams TIKZ CLASS

Post by mayankmi »

Hey. Anyone knows how to put dimensions in this drawing. I made this in Tikz using cm as units but i want to put my dimensions in millimeter as in an AutoCaD drawing has. Any help is appreciated.
Also, just out of curiosity is it possible to HATCH/PATCH some rectangle in this figure likes one does in auto cad. This drawing is much easy to draw in auto cad but Tikz I want to give it a try. thanks ...

Code: Select all

\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{pgf}
\usepackage{bm}
\usetikzlibrary{trees} 
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{subfig}
\usetikzlibrary{arrows,positioning,fit} 
\usetikzlibrary{matrix}
\usetikzlibrary{calc}
\usetikzlibrary{fadings,shapes.arrows,shadows}
\usepackage{tikz,amsmath,siunitx}
\usetikzlibrary{arrows,snakes,backgrounds,patterns,matrix,shapes,fit,calc,shadows,plotmarks}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\PreviewEnvironment{equation}
\setlength\PreviewBorder{20mm}
\PreviewEnvironment{equation*}
\newlength{\imagewidth}
\newlength{\imagescale}
\tikzstyle{arrow} = [thick,->,>=stealth]
\pagestyle{empty}

\thispagestyle{empty}

\begin{document}
\pagestyle{empty}
\begin{tikzpicture}

\draw [black] (0,0) -- (100,0) -- (100,95) -- (0,95) -- (0,0)  ;
\draw [black] (12.5,10) -- (87.5,10) -- (87.5,86) -- (12.5,86) -- (12.5,10)  ;

\draw [black] (0,-115) -- (0,120.5) -- (-10,120.5) -- (-10,-115) -- (0,-115)  ;
\draw [black] (100,-115) -- (100,120.5) -- (110,120.5) -- (110,-115) -- (100,-115)  ;

\draw [black]  (-10,120.5) -- (110,120.5)   ;



\end{tikzpicture}




\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
ignasi
Posts: 20
Joined: Tue Jul 28, 2009 5:10 pm

Dimensions in Diagrams TIKZ CLASS

Post by ignasi »

By default Tikz uses `cm` as unit. Therefore, (1,2) means a point 1cm to the right and 2cm up from origin. You can use `mm` as units with

Code: Select all

\begin{tikzpicture}[x unit=1mm, y unit=1mm]
With this code (1,2) means a point 1mm right and 2mm up from origin.

You can also change units when you want. If instead of (1,2) you write (1 in, 2 mm) means a point 1 inch right and 2 mm up from origin.

About hatching a rectangle, try with next modifications in your code

Code: Select all

\draw [black, pattern=north west lines] (0,0) -- (100,0) -- (100,95) -- (0,95) -- (0,0)  ;
\draw [black, fill=white] (12.5,10) -- (87.5,10) -- (87.5,86) -- (12.5,86) -- (12.5,10)  ;
Post Reply