Math & ScienceThe vertices overlap in tikz

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Autumn_
Posts: 2
Joined: Sun May 07, 2023 12:28 am

The vertices overlap in tikz

Post by Autumn_ »

the vertics overleap in my code. Why? please tell me a good code...

Code: Select all

\documentclass[dvipdfmx]{ltjsarticle}
\usepackage{tikz}
\usetikzlibrary{intersections,calc,arrows.meta}

\begin{document}
  \begin{tikzpicture}
    \coordinate[label=left:A](A)at(0,0)
    \coordinate[label=right:B](B)at(3,0);
    \coordinate[label=above:C](C)at(2,2);
    \draw(A)--(B)--(C)--cycle;
  \end{tikzpicture}
\end{document}
Attachments
スクリーンショット (91).png
スクリーンショット (91).png (11.44 KiB) Viewed 16265 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

The vertices overlap in tikz

Post by Bartman »

Please mark multiline code using the suitable tags.

A semicolon is missing at the end of the first \coordinate command.
Autumn_
Posts: 2
Joined: Sun May 07, 2023 12:28 am

The vertices overlap in tikz

Post by Autumn_ »

Bartman wrote:Please mark multiline code using the suitable tags.

A semicolon is missing at the end of the first \coordinate command.
1st message>> Sorry,what does it means? Sorry I do not good at English... Could you show me a good program code?
2nd message>> oh! thank you! But the result does not change...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

The vertices overlap in tikz

Post by Stefan Kottwitz »

Hi Autumn,

welcome to the forum!

Look at the line for coordinate A here, I put the semicolon at the end. It is missing in your original code. Every TikZ path has to end with a semicolon.

Code: Select all

%!TEX lualatex
\documentclass{ltjsarticle}
\usepackage{tikz}
\usetikzlibrary{intersections,calc,arrows.meta}

\begin{document}
  \begin{tikzpicture}
    \coordinate[label=left:A](A)at(0,0);
    \coordinate[label=right:B](B)at(3,0);
    \coordinate[label=above:C](C)at(2,2);
    \draw(A)--(B)--(C)--cycle;
  \end{tikzpicture}
\end{document}
You can click on "Run LaTeX here" to see that it works.

By the way, I removed the dvipdfmx option, which is not compatible with LuaLaTeX, required by ltjsarticle.

To 2. you accidentally used the "LaTeX" button, which is for inline code marking of LaTeX commands. For multiple lines of code, there's the "Code" button at the left top of the editor field when writing. Not perfect, I guess. I edited it above.

Stefan
LaTeX.org admin
Post Reply