pdf 中並未顯示所有程式碼

pdf 中並未顯示所有程式碼

所以我在網路上找到了一個如何創建某個圖形(tikzpicture)的範例。現在我已經在乳膠中創建了圖形,但不知何故我的標題和部分文字不會顯示。我想這是因為我沒有要文章的文檔類別。但如果我的文件類別是文章,則該圖將不會顯示。我該如何解決這個問題?下面是我的程式碼。

\documentclass[tikz,border=10pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{verbatim}


\usetikzlibrary{calc}
\title{Matematisk modellering}
\author{olba_ }
\date{February 2016}

\begin{document}

\maketitle

\section{Introduction}

\section{Problem 1}

Givet avståndet $d$ från högtalare och ljudkälla, samt givet högtalarnas positioner, beräkna läget för ljudkällan.

\begin{tikzpicture}
  [
    scale=3,
    >=stealth,
    point/.style = {draw, circle,  fill = black, inner sep = 1pt},
    dot/.style   = {draw, circle,  fill = black, inner sep = .2pt},
  ]

  % the circle
  \def\rad{1}
  \node (origin) at (0,0) {};


  % triangle nodes: just points on the circle
  \node (n0) at +(60:\rad) [point, label = above:$s$] {};
  \node (n1) at +(-145:\rad) [point, label = below:$r_{1}$] {};
  \node (n2) at +(-45:\rad) [point, label = {below right:$r_{2}$}] {};
  \node (n3) at +(10:\rad) [point, label = {below left:$r_{3}$}] {};

  % triangle edges: connect the vertices, and leave a node at the midpoint
  \draw[->] (n2) -- node (a) [label = {above left:$d_{2}$}] {} (n0);
  \draw[->] (n1) -- node (b) [label = {below right:$d_{1}$}] {} (n0);
  \draw[->] (n3) -- node (c) [label = {above right:$d_{3}$}] {} (n0);


\end{tikzpicture}

\end{document}

答案1

我猜你想要一篇真實的文章,有標題等等。所以先使用該類article,然後再載入tikz

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{verbatim}
\usepackage{tikz}
\usetikzlibrary{calc}

\title{Matematisk modellering}
\author{name here}
\date{February 2016}

\begin{document}

\maketitle

\section{Introduction}

\section{Problem 1}

Givet avståndet $d$ från högtalare och ljudkälla, samt givet högtalarnas positioner, beräkna läget för ljudkällan.
\begin{figure*}[h]\centering
\begin{tikzpicture}
  [
    scale=3,
    >=stealth,
    point/.style = {draw, circle,  fill = black, inner sep = 1pt},
    dot/.style   = {draw, circle,  fill = black, inner sep = .2pt},
  ]

  % the circle
  \def\rad{1}
  \node (origin) at (0,0) {};


  % triangle nodes: just points on the circle
  \node (n0) at +(60:\rad) [point, label = above:$s$] {};
  \node (n1) at +(-145:\rad) [point, label = below:$r_{1}$] {};
  \node (n2) at +(-45:\rad) [point, label = {below right:$r_{2}$}] {};
  \node (n3) at +(10:\rad) [point, label = {below left:$r_{3}$}] {};

  % triangle edges: connect the vertices, and leave a node at the midpoint
  \draw[->] (n2) -- node (a) [label = {above left:$d_{2}$}] {} (n0);
  \draw[->] (n1) -- node (b) [label = {below right:$d_{1}$}] {} (n0);
  \draw[->] (n3) -- node (c) [label = {above right:$d_{3}$}] {} (n0);


\end{tikzpicture}
\end{figure*}

\end{document}

在此輸入影像描述

相關內容