Diagonal in einer Box schreiben

Tabellen und Grafiken erstellen und anordnen


ie
Forum-Anfänger
Forum-Anfänger
Beiträge: 18
Registriert: Mo 28. Sep 2009, 23:54

Diagonal in einer Box schreiben

Beitrag von ie »

Hallo alle zusammen,
erst mal mein Code
\begin{figure}[ht]
\centering
\begin{picture}(200,100)
	\thicklines
	%\put(0,0){\framebox(200,100)}
	\put(20,70){\framebox(90,30){Roboter}}
	\put(65, 20){\vector(0,1){50}}
	\put(20, 70){\makebox(50,10){\footnotesize a=30cm}}	
	\put(65,70){\vector(0,1){12}}
	\put(30,35){\makebox(50,10){d=?}}
	\put(65, 20){\vector(1,0){40}}
	\put(58,10){\makebox(50,10){\footnotesize b=110cm}}
	\put(105, 20){\vector(-2,3){40}}
	\put(90,50){\makebox(50,10){c=229cm}} 
	
	% Polaris
	\put(105, 20){\line( 1, 2){10}}
	\put(105, 20){\line(-1,-2){10}}
	
	\put(115, 40){\line( 2,-1){15}}
	\put(95, 0){\line( 2,-1){15}}
	
	\put(124, 20){\line( 1, 2){6}}
	\put(124, 20){\line(-1,-2){14}}
	\put(130, 8){\makebox(60,15){\small POLARIS}}
	\put(136,15){\vector(-1,0){15}}
	
  \end{picture}
  \caption{Abstand zwischen Roboter und dem Polaris}
  \label{fig:abstand1}
\end{figure}\\
meine Frage ist, ob es überhaupt möglich ist den text POLARIS in der neben stehende Box diagonal rein zu schreiben oder wie kann ich z.B c=229cm diagonal neben der Linie schreiben.

Danke im Voraus

Benutzeravatar
localghost
Forum-Meister
Forum-Meister
Beiträge: 825
Registriert: Di 8. Jul 2008, 15:40
Wohnort: Braunschweig

Komfortabler

Beitrag von localghost »

Ist schon erstaunlich, dass es noch Leute gibt, die in der picture-Umgebung zeichnen. Du kannst ja mal folgendes versuchen.
\documentclass[11pt,a4paper,ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{%
  adieresis={ä},
  germandbls={ß},
  Euro={€}
}
\usepackage{babel}
\usepackage[%
  load={abbr,physical},
  loctolang={DE:ngerman}
]{siunitx}
\usepackage[%
  font=small,
  labelfont=bf,
  tableposition=top
]{caption}
\usepackage{tikz}

\begin{document}
  \begin{figure}[!ht]
    \centering
    \begin{tikzpicture}[%
      >=stealth,
      every node/.style={%
        inner sep=1pt,
        text badly centered
      }
    ]
      \node[draw,minimum width=3cm,minimum height=1.5cm] (robot) at (0,4) {Roboter};
      \node[draw,rotate=60,minimum width=2cm,minimum height=1cm] (polaris) at (3,0) {Polaris};
      \draw[->] (0,0) -- (polaris) node[below=1pt,midway] {\small $b=\SI{110}{\cm}$};
      \draw[->] (0,0) -- (robot) node[left=1pt,midway] {\small $d=?$};
      \draw[->] (polaris) -- (robot.center) node[above=1pt,midway,sloped] {\small $c=\SI{229}{\cm}$};
      \draw[->] (robot.south) -- (robot.center) node[left=1pt,midway] {\footnotesize $a=\SI{30}{\cm}$};
    \end{tikzpicture}
    \caption{Abstand zwischen Roboter und dem Polaris}\label{fig:abstand1}
  \end{figure}
\end{document}

MfG
Thorsten

ie
Forum-Anfänger
Forum-Anfänger
Beiträge: 18
Registriert: Mo 28. Sep 2009, 23:54

Beitrag von ie »

Hallo Thorsten,

erstmal ein Dankeschön, die Abbildung sieht so aus wie ich auch gerne haben möchte. Außer das die Einheiten bei mir fehlen.
Nur jetz zeigt mir der Compiller sieben fehler an, die ich nicht so ganz richtig nachvolziehe.
Mein Code zu meiner Dokumentklasse sieht folgender maßen aus
\documentclass[a4paper,oneside,11pt,openany,BCOR=10mm,cleardoubleplain]{scrbook}
%%%%%%%%%%%%% Deutsche Anpassungen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{capt-of}
%\usepackage{caption} 
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
%% Packages für Formeln und Farben %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{tabularx}
\usepackage[colorlinks=true,linkcolor=black,citecolor=black]{hyperref}
%\SelectInputMappings{%
 % adieresis={ä},
  %germandbls={ß},
  %Euro={€}
%}
%\usepackage[%
 % load={abbr,physical},
 % loctolang={DE:ngerman}
%]{siunitx}
%\usepackage[%
%  font=small,
 % labelfont=bf,
 % tableposition=top
%]{caption} 
\usepackage{tikz} 
\usepackage{selinput} 
\setcounter{secnumdepth}{3}
\thispagestyle{empty}
\setlength{\textheight} {270mm} 
\setlength{\textwidth} {150mm}
%Kopfzeile
\setlength{\topmargin} {-25mm}
%Fußzeile
\setlength{\footskip} {10mm}
%Seiterand links
\setlength{\oddsidemargin} {10mm} 
%Seite rechts und Rand
\setlength{\marginparwidth} {0mm} 
\setlength{\marginparsep} {0mm}
\parindent0mm 

\begin{document}
\begin{figure}[ht]
    \centering
    \begin{tikzpicture}[%
      >=stealth,
      every node/.style={%
        inner sep=1pt,
        text badly centered}  ]
      \node[draw,minimum width=3cm,minimum height=1.5cm] (robot) at (0,4) {Roboter};
      \node[draw,rotate=60,minimum width=2cm,minimum height=1cm] (polaris) at (3,0) {Polaris};
      \draw[->] (0,0) -- (polaris) node[below=1pt,midway] {\small $b=\SI{110}{\cm}$};
      \draw[->] (0,0) -- (robot) node[left=1pt,midway] {\small $d=?$};
      \draw[->] (polaris) -- (robot.center) node[above=1pt,midway,sloped] {\small $c=\SI{229}{\cm}$};
      \draw[->] (robot.south) -- (robot.center) node[left=1pt,midway] {\footnotesize $a=\SI{30}{\cm}$};
    \end{tikzpicture}
    \caption{Abstand zwischen Roboter und dem Polaris}\label{fig:abstand1}
  \end{figure} 

\end{document}
Die Fehler die der compiller mir zeigt: Die letzten sechs Fehler hat was mit den Einheiten zu tun.

! Package tikz Error: I do not know what to do with the option ``every node/.st
yle={{inner sep=1pt, text badly centered} }''.

See the tikz package documentation for explanation.
Type H <return> for immediate help.
...

l.1728 text badly centered} ]

This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.

! Undefined control sequence.
l.1731 ...s) node[below=1pt,midway] {\small $b=\SI
{110}{\cm}$};
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.1731 ...elow=1pt,midway] {\small $b=\SI{110}{\cm
}$};
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.1733 ...[above=1pt,midway,sloped] {\small $c=\SI
{229}{\cm}$};
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.1733 ...t,midway,sloped] {\small $c=\SI{229}{\cm
}$};
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.1734 ...e[left=1pt,midway] {\footnotesize $a=\SI
{30}{\cm}$};
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.1734 ...pt,midway] {\footnotesize $a=\SI{30}{\cm
}$};
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Danke im Voraus für die super Hilfe

Benutzeravatar
localghost
Forum-Meister
Forum-Meister
Beiträge: 825
Registriert: Di 8. Jul 2008, 15:40
Wohnort: Braunschweig

Selbst schuld

Beitrag von localghost »

Wenn ich ein Beispiel angebe, dann ist auch alles darin notwendig, um den Code lauffähig zu machen. (Hier mal abgesehen von caption.) Du solltest also davon nichts auskommentieren oder die Reihenfolge ändern. Letzteres betrifft insbesondere das Paket selinput mit dem anschließenden befehl \SelectInputMappings. Diese Konstruktion ist ein Ersatz für das Paket inputenc. Wenn Du das nicht willst, dann lass es raus. Außerdem solltest Du ab und zu mal Anleitungen zu Paketen studieren und diese nicht blind aus einem Beispiel übernehmen. Dann weißt Du auch, was sie machen und was dazu nötig ist, damit sie ihre Aufgabe erledigen. Offensichtlich hast Du mein Beispiel wie vorgestellt vorher nicht getestet, sondern einfach irgendwie eingebaut.

Einige Fehler werden verschwinden, wenn Du siunitx mit den angegeben Optionen wieder lädst. Es ist für den korrekten Satz von Einheiten verantwortlich. Die anderen Fehler werden von einer veralteten Version von pgf/tikZ verursacht. Hier ist also eine Aktualisierung angesagt.
TeX und LaTeX, Fragen und Antworten – TeXwelt

¹ Es tut mir Leid. Meine Antworten sind begrenzt. Sie müssen die richtigen Fragen stellen.
² System: openSUSE 13.1 (Linux 3.11.6), TeX Live 2013, TeXworks 0.5 (r1349)
³ Lernt gerade TeX (und versucht, es zu verstehen).

ie
Forum-Anfänger
Forum-Anfänger
Beiträge: 18
Registriert: Mo 28. Sep 2009, 23:54

Beitrag von ie »

hallo Thorsten,

ich hab mir dein Bsp. vorher compiliert aber das hatte nicht funktioniert
Hier dein Code
\documentclass[11pt,a4paper,ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{%
  adieresis={ä},
  germandbls={ß},
  Euro={€}
}
\usepackage{babel}
\usepackage[%
  load={abbr,physical},
  loctolang={DE:ngerman}
]{siunitx}
\usepackage[%
  font=small,
  labelfont=bf,
  tableposition=top
]{caption}
\usepackage{tikz}

\begin{document}
  \begin{figure}[!ht]
    \centering
    \begin{tikzpicture}[%
      >=stealth,
      every node/.style={%
        inner sep=1pt,
        text badly centered
      }
    ]
      \node[draw,minimum width=3cm,minimum height=1.5cm] (robot) at (0,4) {Roboter};
      \node[draw,rotate=60,minimum width=2cm,minimum height=1cm] (polaris) at (3,0) {Polaris};
      \draw[->] (0,0) -- (polaris) node[below=1pt,midway] {\small $b=\SI{110}{\cm}$};
      \draw[->] (0,0) -- (robot) node[left=1pt,midway] {\small $d=?$};
      \draw[->] (polaris) -- (robot.center) node[above=1pt,midway,sloped] {\small $c=\SI{229}{\cm}$};
      \draw[->] (robot.south) -- (robot.center) node[left=1pt,midway] {\footnotesize $a=\SI{30}{\cm}$};
    \end{tikzpicture}
    \caption{Abstand zwischen Roboter und dem Polaris}\label{fig:abstand1}
  \end{figure}
\end{document}
und die Fehler Meldungen:

! LaTeX Error: File `siunitx.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name:
! Emergency stop.
<read *>

l.14 \usepackage
[%

*** (cannot \read from terminal in nonstop modes)


Here is how much of TeX's memory you used:
2134 strings out of 95340
28335 string characters out of 1184001
74891 words of memory out of 1500000
5340 multiletter control sequences out of 110000
4709 words of font info for 16 fonts, out of 1200000 for 2000
14 hyphenation exceptions out of 8191
35i,0n,35p,302b,613s stack positions out of 5000i,500n,10000p,200000b,5000s
! ==> Fatal error occurred, no output PDF file produced!

Wer ist den Selbst schuld?

danke

Benutzeravatar
localghost
Forum-Meister
Forum-Meister
Beiträge: 825
Registriert: Di 8. Jul 2008, 15:40
Wohnort: Braunschweig

Fehlendes Paket nachinstallieren

Beitrag von localghost »

siunitx ist bei dir nicht vorhanden. Einfach mit dem Paket-Manager deiner LaTeX-Distribution nachinstallieren.
TeX und LaTeX, Fragen und Antworten – TeXwelt

¹ Es tut mir Leid. Meine Antworten sind begrenzt. Sie müssen die richtigen Fragen stellen.
² System: openSUSE 13.1 (Linux 3.11.6), TeX Live 2013, TeXworks 0.5 (r1349)
³ Lernt gerade TeX (und versucht, es zu verstehen).

phi
Moderator
Moderator
Beiträge: 420
Registriert: Fr 6. Feb 2009, 21:28

Beitrag von phi »

ie hat geschrieben:Außer das die Einheiten bei mir fehlen.
Nur jetz zeigt mir der Compiller sieben fehler an, die ich nicht so ganz richtig nachvolziehe.
Das ist nicht weiter verwunderlich, wenn du den Code willkürlich umstellst, Pakete auskommentierst usw. Hier eine korrigierte Version:
\documentclass[paper=a4, twoside=false, fontsize=11pt, open=any, BCOR=10mm, cleardoublepage=plain, captions=tableheading, pagesize=auto, version=last]{scrbook} 
%%%%%%%%%%%%% Deutsche Anpassungen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%\usepackage{capt-of} 
%\usepackage{caption} 
\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc} 
\usepackage[latin1]{inputenc} 
\usepackage{graphicx} 
%% Packages für Formeln und Farben %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\usepackage{amsmath} 
\usepackage{amsthm} 
\usepackage{amsfonts} 
\usepackage{color} 
\usepackage{tabularx} 
\usepackage{selinput}
\SelectInputMappings{% 
  adieresis={ä}, 
  germandbls={ß}, 
  Euro={€} 
} 
\usepackage[% 
  load={abbr,physical}, 
  loctolang={DE:ngerman} 
]{siunitx} 
\usepackage[% 
  font=small, 
  labelfont=bf, 
  %tableposition=top 
]{caption} 
\usepackage{tikz}
\usepackage[colorlinks=true,linkcolor=black,citecolor=black]{hyperref} 
\setcounter{secnumdepth}{3} 
%%% für Randanpassungen Pakete wie typearea oder geometry benutzen!

\begin{document} 
\begin{figure}[ht] 
    \centering 
    \begin{tikzpicture}[% 
      >=stealth, 
      every node/.style={% 
        inner sep=1pt, 
        text badly centered}  ] 
      \node[draw,minimum width=3cm,minimum height=1.5cm] (robot) at (0,4) {Roboter}; 
      \node[draw,rotate=60,minimum width=2cm,minimum height=1cm] (polaris) at (3,0) {Polaris}; 
      \draw[->] (0,0) -- (polaris) node[below=1pt,midway] {\small $b=\SI{110}{\cm}$}; 
      \draw[->] (0,0) -- (robot) node[left=1pt,midway] {\small $d=?$}; 
      \draw[->] (polaris) -- (robot.center) node[above=1pt,midway,sloped] {\small $c=\SI{229}{\cm}$}; 
      \draw[->] (robot.south) -- (robot.center) node[left=1pt,midway] {\footnotesize $a=\SI{30}{\cm}$}; 
    \end{tikzpicture} 
    \caption{Abstand zwischen Roboter und dem Polaris}\label{fig:abstand1} 
  \end{figure} 

\end{document}

Antworten