LaTeX-tikz drawing perpendicular line

In summary, the person used code from another thread to draw a line on an image, but they are unsure how to change the length of the line. They want the line to pass through specific points, but not go below a certain point. They can use the "shorten" option in the code to control the length of the line. To make the line into an arrow, they can use the "->" option instead of the "<->" option in the code.
  • #1
binbagsss
1,254
11
I copied and pasted some code from another thread on this forum, and it has worked, however I am unsure how to change the length of the line. On the attached image, the line is the one labelled H(X,T). I want the line to be perpendicular to the plane- to pass through the blue node labelled (dfd) and a point of F(X,T), as it does. But I do not want it to go below dfd as it does at the moment. formatchange.png

This is the code I used:

\node
at (4.1,2.5) {H(X,T)};
\coordinate (C) at (7,3);
\coordinate (O) at (5.4,2.3);
\node at (5.4,2.3){dfd};
\tkzDefLine[orthogonal=through C](C,O);
\tkzDrawLine[,add = .6 and 0.02,color=black](O,tkzPointResult);

and changing the first parameter- the 0.6 shortens it from the other end , so e.g 0.4 was to short for it to intersect F(X,T), and I'm not sure what the other parameter does, I have changed it but have not noticed any difference. It is the length of the line from the other end that I want to control.

(On another note, how do I turn this into an arrow, when I tried `\tkzDrawLine[<->,add = .6 and 0.02,color=black](O,tkzPointResult)` it produced an error.


 
Physics news on Phys.org
  • #2
Any help would be greatly appreciated.You can use the 'shorten' option in the \tkzDrawLine command to control the length of the line. For example, the following code will draw a line from dfd to F(X,T) with a length of 2cm:\node at (5.4,2.3){dfd};\tkzDefLine[orthogonal=through C](C,O);\tkzDrawLine[shorten >=2cm,color=black](O,tkzPointResult);To draw an arrow, use the '->' option instead of the '<->' option. For example:\tkzDrawLine[shorten >=2cm,->,color=black](O,tkzPointResult);
 

1. How do I draw a perpendicular line using LaTeX-tikz?

To draw a perpendicular line using LaTeX-tikz, you can use the \draw command along with the [perpendicular] option. For example, \draw (0,0) -- (1,1) [perpendicular] (1,1) -- (1,0); will draw a perpendicular line from the point (1,1) to the line connecting (0,0) and (1,0).

2. Can I customize the style of the perpendicular line?

Yes, you can customize the style of the perpendicular line by adding additional options to the [perpendicular] option. For example, [perpendicular, thick, dashed, red] will draw a thick, dashed, red perpendicular line.

3. How do I specify the length of the perpendicular line?

You can specify the length of the perpendicular line by using the [shorten < > = <length>] option. For example, [perpendicular, shorten < > = 0.2cm] will shorten the perpendicular line by 0.2cm on both ends.

4. Can I draw a perpendicular line from a point to a specific coordinate?

Yes, you can draw a perpendicular line from a point to a specific coordinate by using the [perpendicular = <point>] option. For example, [perpendicular = {(1,1)}] will draw a perpendicular line from the current point to the coordinate (1,1).

5. How do I label the perpendicular line?

To label the perpendicular line, you can use the \node command and specify the label in the label option. For example, \node [label = above: P] at (1,1); will label the point (1,1) with the letter P. You can then use this label in other parts of your drawing.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
937
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
700
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
992
Back
Top