1

In the code below, I want to change the length of the bottom line- the red arrow, see image attached. I am aware how to do this in a usual line of code, but this piece of code (copied and pasted to create a perpendicular line, I am not sure off, I have tried length=3, length=3cm , after the '<->' but it renders an error. Many thanks ! enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps}
\usepackage{graphicx}

\usepackage[T1]{fontenc} \usepackage{amsfonts} %\usepackage[pdftex]{graphicx} % Comment the following line to NOT allow the usage of umlauts \usepackage{pgfgantt} \usetikzlibrary{angles,calc,math} \usepackage{tkz-euclide} \usepackage{pdflscape}

% Start the docu

\usepackage{xcolor} \usetikzlibrary{positioning}

\usepackage{amsmath} \usepackage{tikz}

\bibliographystyle{IEEEtran}

%\pagestyle{fancyplain}

\begin{document}

\begin{figure} \centerline {\begin{tikzpicture} \draw[dashed] (0,0)--(7,3); \draw[dashed] (7,3)--(7,0); \draw [dashed] (7,0)--(0,0); \node[right] at (0.6,0.1) {$\theta$}; \draw<->, ultra thin,gray--(0.1,-0.28); \node [below] at (3.6, 1.3) {$L_p$};

\draw ->, ultra thick--(6.6,2.8) ; %^ x axis

%addgravitylabel \draw[->, ultra thick] (3,4)--(3,3.5); \node[left] at (3,4.0){$\bf{g}$};

\node [below] at (6.8,2.9) {X};

% S(X) \draw [thick ] (4,1.75) to [out=90,in=180] (5,2.15); to [out=0,in=180] (5.5,2.0) to [out=0,in=-135] (6.0,2.6); \draw [thick] (6,2.6) to [out=90,in=180] (7,3.05); \drawthick--(6,2.6); \drawthick--(0,0);

%F(X,T) \draw [thick, ] (0,1) to [out=90,in=180] (1,1.45) to [out=0,in=180] (1.5,1.37) to [out=0,in=-135] (2.0,1.9) ; \draw [,thick, ] (2,1.9) to [out=90,in=180] (3,2.35) to [out=0,in=180] (3.5,2.25) to [out=0,in=-135] (4.0,2.75); \draw [,thick, ] (4,2.75) to [out=90,in=180] (5,3.2) to [out=0,in=180] (5.5,3.1) to [out=0,in=-135] (6.0,3.6); \draw [,thick,] (6,3.6) to [out=90,in=180] (7,4.05);

\draw [thin, ] (2.5,0) to [out=90,in=0] (2,0.85);

%length and depth

%free-surfacelabel %inclineplanelabel

\draw[ <-, thin] (6,2.6)--(5.5,4.3); \draw[<-, thin] (1,1.45)--(-0.7,2.8); \node at (5.5,4.3) {$S(X)$}; %\node[above] \node at (-0.8,3) {$F(X,T)$};

% Z AXIS To change \draw [->,ultra thick] (7,3)--(6.7,3.5); \node[right] at (7,3.3) {Z};

% PERPENDICULAR QUESTION HERE !! %\draw [<->,thin] (3.6,1.5)--(3.55,2.28) ; \node[right] at (4.5,2.7) {H(X,T)};

%\node[color=blue] at (5.4,2.3){dfd}; %\tkzDefLineorthogonal=through C; %\tkzDrawLine,add = .6 and 0.02,color=black;

\coordinate (O) at (5.7,2.5) ; \coordinate (E) at (5.4,2.35);

\draw[thick] (O)--(E) nodepos=3.0,color=white{a} ; \draw[red,<->,thin,transform canvas={rotate around={90:(x)}}] (O) -- (E) ;

\end{tikzpicture}}

\end{figure} \end{document}

azetina
  • 28,884
  • You are defining two coordinates (O) and (E). First you are using them to place a WHITE node!? and then you rotate them to place your red arrow. I fail to see the logic. If you just want to make it longer or shorter, you can use shorten - see: https://tex.stackexchange.com/questions/311213/how-does-the-shorten-option-work – hpekristiansen Nov 15 '20 at 19:46
  • i dotn know the logic, copied and pasted the code as i said to make a perpendicular line cause I dont know how to do it ! okay many thanks, also how to I replace the node label with just a dot? instead of a letter 'a'. thank you – Sara Ismail-Sutton Nov 16 '20 at 14:43
  • Why would you want a white dot? What is your background color? Here is different kind of dots: https://tex.stackexchange.com/questions/19180/which-dot-character-to-use-in-which-context – hpekristiansen Nov 16 '20 at 20:26

1 Answers1

1

I try to guess what you want and rewrite all of your code. Specifically, I use calc - you can find explanation in the manual. It is also perfectly acceptable to use explicit coordinates.

\documentclass[tikz, border=1cm]{standalone}
\usepackage{tikz-dimline}
\usetikzlibrary{angles, quotes, calc}
\begin{document}
\begin{tikzpicture}[>=latex]
\coordinate (A) at (0,0);
\coordinate (B) at (7,3);
\coordinate (C) at (7,0);

\draw[dashed] (A)--(B)--(C)--cycle; \draw pic["$\theta$", draw, angle radius=2cm, angle eccentricity=0.8] {angle=C--A--B}; \dimline{ ($ (B)!1cm!90:(A) $) } { ($ (A)!1cm!-90:(B) $) } {$L_P$}; \draw[->, ultra thick] (B) -- node[right]{$\vec Z$} ($ (B)!0.5cm!-90:(A) $); \draw[->, ultra thick] (B) -- node[below]{$\vec X$} ($ (B)!0.5cm!(A) $); \draw[->, ultra thick] (3,4) -- node[left] {$\vec g$} (3,3.5);
\draw [thick ] ($(A)+(0,0.1) $) -- (4,1.8) to [out=90,in=180] (5,2.2) -- (5.9,2.6) to [out=90,in=180] (6.8,3); \draw [thick, ] (0,1) to [out=90,in=180] (1,1.45) to [out=0,in=180] (1.5,1.37) to [out=0,in=-135] (2,1.9) to [out=90,in=180] (3,2.35) to [out=0,in=180] (3.5,2.25) to [out=0,in=-135] (4,2.75) to [out=90,in=180] (5,3.2) to [out=0,in=180] (5.5,3.1) to [out=0,in=-135] (6,3.6) to [out=90,in=180] (7,4.05); \draw[ <-] (6.2,2.7)--(5.5,4.3) node[above] {$S(X)$}; \draw[<-] (0.5,1.5)--(-0,2.8) node[above] {$F(X,T)$}; \draw[red,<->] ($ ($ (B)!2.5cm!(A) $)!0.3cm!90:(B) $) -- ($ ($ (B)!2.5cm!(A) $)!1.1cm!90:(B) $); \node[right] at (4.4,2.7) {H(X,T)}; \end{tikzpicture} \end{document}

Drawing

Edit:

From calc

The general meaning of ⟨a⟩!⟨factor⟩!⟨angle⟩:⟨b⟩ is: “First, consider the line from ⟨a⟩ to ⟨b⟩. Then rotate this line by ⟨angle⟩ around the point ⟨a⟩. Then the two endpoints of this line will be ⟨a⟩ and some point ⟨c⟩. Use this point ⟨c⟩ for the subsequent computation, namely the partway computation.”

-much easier just to look at examples p. 150 in the manual.