Seite 2 von 2

Verfasst: Fr 8. Sep 2017, 09:23
von Beinschuss
Zu 1.
Ich habe es geschaft mit $\bullet$ die gewünschten Punkte einzufügen.
Leider scheint es ziemlich kompliziert zu sein diesen unter die Zahl zu positionieren. Zeilenumbrüche Node - Befehl, alles liefert nicht das gewünschte Ergebnis oder zeigt fehlmeldungen.
Dann wähle doch einen Spaltentyp, der Umbrüche zulässt (p-Spalten):
\documentclass{article}
\usepackage{booktabs}
\begin{document} 
\begin{center} 
\begin{tabular}{p{1cm}p{1cm}p{1cm}} 
\toprule 
1 & 2\par$\bullet$ & 3 \\ 
\midrule
4 & 5 & 6\par$\bullet$ \\ 
\midrule
7\par$\bullet$ & 8 & 9 \\ 
\bottomrule
\end{tabular}
\end{center} 
\end{document}

Verfasst: Mo 11. Sep 2017, 19:20
von Milo
Hallo Beinschuss,
ich kenne den \par Befehl, aber dann verschiebt es bei mir alles.

Danach sind die einzelnen Zellenbeschriftungen aus der Mitte.
\centering bringt da irgend wie nichts.
Ich stell hier mal meinen Versuch soweit ich ihn habe ein

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin {center}
\begin{tabular}{p{3cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}}
\toprule

\diagbox{\textbf{Z\"ahler}}{\textbf{Nenner}} & $ \textbf{1} $ & $ \textbf{\color{red}{-1}} $ & $\textbf{2} $ & $ \textbf{\color{red}{-2}} $ & $ \textbf{3} $ & $ \textbf{\color{red}{-3}} $ & $ \textbf{4} $ & $ \textbf{\color{red}{-4}} $ & $ \textbf{5} $ & $ \textbf{n-1} $ & $ \textbf{n+1} $ \\ \midrule
$\textbf{0} $ & $ a_{11} $ & \color{red} $ a_{12} $ & $ a_{13} $ & \color{red} $ a_{14} $ & $ a_{15} $ & \color{red} $ a_{16} $ & $ a_{17} $ & \color{red} $ a_{18} $ & $ a_{19} $ & \dots & \dots \\ \midrule
$\textbf{1} $ & $ a_{21} $ \par $\bullet$ & \color{red} $ a_{22} $ & $ a_{23} $ \par $\bullet$ & \color{red} $ a_{24} $ & $ a_{25} $ \par $\bullet$ & \color{red} $ a_{26} $ & $ a_{27} $ \par $ \bullet $ & \color{red} $ a_{28} $ & $ a_{29} $ \par $\bullet $ & \dots & \dots \\ \midrule
$ \textbf{\color{red}{-1}} $ & \color{red} $ a_{31} $ & \color{green} $ a_{32} $ & \color{red} $ a_{33} $ & \color{green} $ a_{34} $ & \color{red} $ a_{35} $ & \color{green} $ a_{36} $ & \color{red} $ a_{37} $ & \color{green} $ a_{38} $ & \dots & \dots & \dots \\ \midrule
$ \textbf{2} $ & $ a_{41} $ \par $\bullet$ & \color{red} $ a_{42} $ & \color{green} $ a_{43} $ \par \color{black} $ \bullet $ &\color{red} $ a_{44} $ & $ a_{45} $ \par $\bullet $ & \color{red} $ a_{46} $ &\color{green} $ a_{47} $ \color{black} \par $ \bullet $ & \dots & \dots & \dots & \dots \\ \midrule
$ \textbf{\color{red}{-2}} $ & \color{red} $ a_{51} $ & \color{green} $a_{52} $ & \color{red} $ a_{53} $ & \color{green} $ a_{54} $ & \color{red} $ a_{55} $ & \color{green} $ a_{56} $ & \dots & \dots & \dots & \dots & \dots \\ \midrule
$ \textbf{3} $ & $a_{61} $ \par $ \bullet $ &\color{red} $ a_{62} $ & $ a_{63} $ \par $ \bullet $ & \color{red} $ a_{64} $ & \color{green} $ a_{65} $ \color{black} \par $ \bullet $ & \dots & \dots & \dots & \dots & \dots & \dots \\ \midrule
$ \textbf{\color{red}{-3}} $ & \color{red} $ a_{71} $ & \color{green} $ a_{72} $ & \color{red} $ a_{73} $ & \color{green} $ a_{74} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ \midrule
$ \textbf{4} $ & $ a_{81} $ \par $ \bullet $ & \color{red} $ a_{82} $ & \color{green} $ a_{83} $ \par \color{black} $ \bullet $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ \midrule
$ \textbf{\color{red}{-4}} $ & \color{red} $ a_{91} $ \par \color{black} $ \bullet $ &\color{green} $a_{92} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ \midrule
$ \textbf{5} $ & $ a_{01} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ \midrule
$ \textbf{n-1} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ \midrule
\bottomrule
\end{tabular}
\end{center}
\end{dokument}

Ist hoffe ich habe diesesmal ein funktionierendes "Minimalbeispiel" geliefert.

mit dem \par code sind nun plötzlich alle Angaben horizontal wie vertikal aus der Mitte der jeweiligen Zelle.

Wenn ich den code sehe wird mir ganz anders wenn ich daran denke, dass da noch eine Pfeilführung durch die Tabelle muss.

Gibt es da keine Möglichkeit eine der a_00 zahlen als Startkoordinate und eine ander als Zielkoordinate festzulegen?

Grüße Milo

Verfasst: Di 12. Sep 2017, 06:47
von markusv
Milo hat geschrieben:Ist hoffe ich habe diesesmal ein funktionierendes "Minimalbeispiel" geliefert.
Nein, leider ganz und gar nicht. Das hättest du aber ganz einfach überprüfen können, wenn du den Code ordentlich als Code eingepflegt (auch ein Merkmal eines Minimalbeispiels) und anschließend im Online-Editor überprüft hättest. Die Umgebung dokument gibt es nicht. Außerdem fehlen Pakete.
Milo hat geschrieben:Danach sind die einzelnen Zellenbeschriftungen aus der Mitte.
\centering bringt da irgend wie nichts.
Das kommt darauf an, wo und wie man es unterbringt. Im folgenden Code sind die Zellen zentriert.
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{diagbox}
\usepackage{xcolor}
\begin{document} 
%\begin {center} 
\begin{tabular}{>{\centering\arraybackslash}p{3cm}*{11}{>{\centering\arraybackslash}m{1cm}}} 
    \toprule 
    \diagbox{\textbf{Zähler}}{\textbf{Nenner}} & $ \textbf{1} $ & $ \textbf{\color{red}{-1}} $ & $\textbf{2} $ & $ \textbf{\color{red}{-2}} $ & $ \textbf{3} $ & $ \textbf{\color{red}{-3}} $ & $ \textbf{4} $ & $ \textbf{\color{red}{-4}} $ & $ \textbf{5} $ & $ \textbf{n-1} $ & $ \textbf{n+1} $ \\ 
    \midrule 
    $\textbf{0} $ & $ a_{11} $ & \color{red} $ a_{12} $ & $ a_{13} $ & \color{red} $ a_{14} $ & $ a_{15} $ & \color{red} $ a_{16} $ & $ a_{17} $ & \color{red} $ a_{18} $ & $ a_{19} $ & \dots & \dots \\ 
    \midrule 
    $\textbf{1} $ & $ a_{21} $ \par $\bullet$ & \color{red} $ a_{22} $ & $ a_{23} $ \par $\bullet$ & \color{red} $ a_{24} $ & $ a_{25} $ \par $\bullet$ & \color{red} $ a_{26} $ & $ a_{27} $ \par $ \bullet $ & \color{red} $ a_{28} $ & $ a_{29} $ \par $\bullet $ & \dots & \dots \\
    \midrule 
    $ \textbf{\color{red}{-1}} $ & \color{red} $ a_{31} $ & \color{green} $ a_{32} $ & \color{red} $ a_{33} $ & \color{green} $ a_{34} $ & \color{red} $ a_{35} $ & \color{green} $ a_{36} $ & \color{red} $ a_{37} $ & \color{green} $ a_{38} $ & \dots & \dots & \dots \\ 
    \midrule 
    $ \textbf{2} $ & $ a_{41} $ \par $\bullet$ & \color{red} $ a_{42} $ & \color{green} $ a_{43} $ \par \color{black} $ \bullet $ &\color{red} $ a_{44} $ & $ a_{45} $ \par $\bullet $ & \color{red} $ a_{46} $ &\color{green} $ a_{47} $ \color{black} \par $ \bullet $ & \dots & \dots & \dots & \dots \\ 
    \midrule 
    $ \textbf{\color{red}{-2}} $ & \color{red} $ a_{51} $ & \color{green} $a_{52} $ & \color{red} $ a_{53} $ & \color{green} $ a_{54} $ & \color{red} $ a_{55} $ & \color{green} $ a_{56} $ & \dots & \dots & \dots & \dots & \dots \\ 
    \midrule 
    $ \textbf{3} $ & $a_{61} $ \par $ \bullet $ &\color{red} $ a_{62} $ & $ a_{63} $ \par $ \bullet $ & \color{red} $ a_{64} $ & \color{green} $ a_{65} $ \color{black} \par $ \bullet $ & \dots & \dots & \dots & \dots & \dots & \dots \\ 
    \midrule 
    $ \textbf{\color{red}{-3}} $ & \color{red} $ a_{71} $ & \color{green} $ a_{72} $ & \color{red} $ a_{73} $ & \color{green} $ a_{74} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ 
    \midrule 
    $ \textbf{4} $ & $ a_{81} $ \par $ \bullet $ & \color{red} $ a_{82} $ & \color{green} $ a_{83} $ \par \color{black} $ \bullet $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ 
    \midrule 
    $ \textbf{\color{red}{-4}} $ & \color{red} $ a_{91} $ \par \color{black} $ \bullet $ &\color{green} $a_{92} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ 
    \midrule 
    $ \textbf{5} $ & $ a_{01} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ \midrule 
    $ \textbf{n-1} $ & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ 
    %\midrule 
    \bottomrule 
\end{tabular} 
%\end{center} 
\end{document}
Milo hat geschrieben:mit dem \par code sind nun plötzlich alle Angaben horizontal wie vertikal aus der Mitte der jeweiligen Zelle.
Ich habe die Spaltendefinition zu m geändert, um die vertikale Ausrichtung zu erreichen.
Milo hat geschrieben:Wenn ich den code sehe wird mir ganz anders wenn ich daran denke, dass da noch eine Pfeilführung durch die Tabelle muss.

Gibt es da keine Möglichkeit eine der a_00 zahlen als Startkoordinate und eine ander als Zielkoordinate festzulegen?
Neben der Umsetzung mit tikZ kenne ich keine weitere Möglichkeit. Die matrix- und Tabellenstruktur sind nicht so verschieden. Das gegebene Beispiel zeigt, dass es sich lohnen kann.

Verfasst: Di 12. Sep 2017, 12:03
von esdd
Statt $\textbf{1}$ kann man auch gleich \textbf{1} schreiben. Das Argument wird in beiden Fällen im Textmodus ausgegeben.

Hier ist mal noch ein Vorschlag für die Tabelle:
\documentclass[margin=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{diagbox}
\usepackage{xcolor}
\colorlet{cell1}{red}
\colorlet{cell2}{green}
\usepackage{amsmath}
\newcommand\bulletcell[1]{%
  \genfrac{}{}{0pt}{0}{#1}{\color{black}\bullet}%
}
\begin{document}
\begin{tabular}{
  >{\centering\arraybackslash\boldmath$}p{3.1cm}<{$}
  *{11}{>{\centering\arraybackslash$}m{1cm}<{$}}
}
  \toprule 
  \text{\diagbox{\textbf{Zähler}}{\textbf{Nenner}}}
    &\text{\boldmath$1$}
    &\text{\boldmath$\color{cell1}{-1}$}
    &\text{\boldmath$2$}
    &\text{\boldmath$\color{cell1}{-2}$}
    &\text{\boldmath$3$}
    &\text{\boldmath$\color{cell1}{-3}$}
    &\text{\boldmath$4$}
    &\text{\boldmath$\color{cell1}{-4}$}
    &\text{\boldmath$5$}
    &\text{\boldmath$n-1$}
    &\text{\boldmath$n+1$}
    \\\midrule 
  0
    &a_{11}
    &\color{cell1}a_{12}
    &a_{13}
    &\color{cell1}a_{14}
    & a_{15}
    &\color{cell1}a_{16}
    & a_{17}
    &\color{cell1}a_{18}
    & a_{19}
    &\dots&\dots
    \\\midrule 
  1
    &\bulletcell{a_{21}}
    &\color{cell1}a_{22}
    &\bulletcell{a_{23}}
    &\color{cell1}a_{24}
    &\bulletcell{a_{25}}
    &\color{cell1}a_{26}
    &\bulletcell{a_{27}}
    &\color{cell1}a_{28}
    &\bulletcell{a_{29}}
    &\dots&\dots
    \\\midrule
  \color{cell1}{-1}
    &\color{cell1}a_{31}
    &\color{cell2}a_{32}
    &\color{cell1}a_{33}
    &\color{cell2}a_{34}
    &\color{cell1}a_{35}
    &\color{cell2}a_{36}
    &\color{cell1}a_{37}
    &\color{cell2}a_{38}
    &\dots&\dots&\dots
    \\\midrule
  2
    &\bulletcell{a_{41}}
    &\color{cell1}a_{42}
    &\color{cell2}\bulletcell{a_{43}}
    &\color{cell1}a_{44}
    &\bulletcell{a_{45}}
    &\color{cell1}a_{46}
    &\color{cell2}\bulletcell{a_{47}}
    &\dots&\dots&\dots&\dots
    \\\midrule
  \color{cell1}{-2}
    &\color{cell1}a_{51}
    &\color{cell2}a_{52}
    &\color{cell1}a_{53}
    &\color{cell2}a_{54}
    &\color{cell1}a_{55}
    &\color{cell2}a_{56}
    &\dots&\dots&\dots&\dots&\dots
    \\\midrule
  3
    &\bulletcell{a_{61}}
    &\color{cell1}a_{62}
    &\bulletcell{a_{63}}
    &\color{cell1}a_{64}
    &\color{cell2}\bulletcell{a_{65}}
    &\dots&\dots&\dots&\dots&\dots&\dots
    \\\midrule
  \color{cell1}{-3}
    &\color{cell1}a_{71}
    &\color{cell2}a_{72}
    &\color{cell1}a_{73}
    &\color{cell2}a_{74}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\\midrule
  4
    &\bulletcell{a_{81}}
    &\color{cell1}a_{82}
    &\color{cell2}\bulletcell{a_{83}}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\\midrule
  \color{cell1}{-4}
    &\color{cell1}\bulletcell{a_{91}}
    &\color{cell2}a_{92}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\\midrule
  5
    &a_{01}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\\midrule
  n-1
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\
  \bottomrule
\end{tabular}
\end{document}
und alternativ mit TikZ:
\documentclass[margin=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand\bulletcell[1]{%
  \genfrac{}{}{0pt}{0}{#1}{\color{black}\bullet}%
}
\colorlet{cell1}{red}
\colorlet{cell2}{green}
\begin{document}
\begin{tikzpicture}
\matrix[
  matrix of math nodes,
  column sep=-\pgflinewidth,
  row sep=-\pgflinewidth,
  inner sep=0pt,
  nodes={
    minimum width=1.2cm,
    inner xsep=.15em,
    text height=1.5em,
    text depth=2ex,
    inner ysep=.35em,
    %draw
  },
  column 1/.style={font=\boldmath},
  row 1/.style={font=\boldmath}
](m){
  |[minimum width=3.1cm,minimum height=3em]|{}
    &1
    &|[cell1]|-1
    &2
    &|[cell1]|-2
    &3
    &|[cell1]|-3
    &4
    &|[cell1]|-4
    &5
    &n-1
    &n+1
    \\
  0
    &a_{11}
    &|[cell1]|a_{12}
    &a_{13}
    &|[cell1]|a_{14}
    & a_{15}
    &|[cell1]|a_{16}
    & a_{17}
    &|[cell1]|a_{18}
    & a_{19}
    &\dots&\dots
    \\
  1
    &\bulletcell{a_{21}}
    &|[cell1]|a_{22}
    &\bulletcell{a_{23}}
    &|[cell1]|a_{24}
    &\bulletcell{a_{25}}
    &|[cell1]|a_{26}
    &\bulletcell{a_{27}}
    &|[cell1]|a_{28}
    &\bulletcell{a_{29}}
    &\dots&\dots
    \\
  |[cell1]|-1
    &|[cell1]|a_{31}
    &|[cell2]|a_{32}
    &|[cell1]|a_{33}
    &|[cell2]|a_{34}
    &|[cell1]|a_{35}
    &|[cell2]|a_{36}
    &|[cell1]|a_{37}
    &|[cell2]|a_{38}
    &\dots&\dots&\dots
    \\
  2
    &\bulletcell{a_{41}}
    &|[cell1]|a_{42}
    &|[cell2]|\bulletcell{a_{43}}
    &|[cell1]|a_{44}
    &\bulletcell{a_{45}}
    &|[cell1]|a_{46}
    &|[cell2]|\bulletcell{a_{47}}
    &\dots&\dots&\dots&\dots
    \\
  |[cell1]|-2
    &|[cell1]|a_{51}
    &|[cell2]|a_{52}
    &|[cell1]|a_{53}
    &|[cell2]|a_{54}
    &|[cell1]|a_{55}
    &|[cell2]|a_{56}
    &\dots&\dots&\dots&\dots&\dots
    \\
  3
    &\bulletcell{a_{61}}
    &|[cell1]|a_{62}
    &\bulletcell{a_{63}}
    &|[cell1]|a_{64}
    &|[cell2]|\bulletcell{a_{65}}
    &\dots&\dots&\dots&\dots&\dots&\dots
    \\
  |[cell1]|-3
    &|[cell1]|a_{71}
    &|[cell2]|a_{72}
    &|[cell1]|a_{73}
    &|[cell2]|a_{74}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\
  4
    &\bulletcell{a_{81}}
    &|[cell1]|a_{82}
    &|[cell2]|\bulletcell{a_{83}}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\
  |[cell1]|-4
    &|[cell1]|\bulletcell{a_{91}}
    &|[cell2]|a_{92}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\
  5
    &a_{01}
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
    \\
  n-1
    &\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots&\dots
\\};
\draw[shorten <=5pt,shorten >=5pt](m-1-1.north west)--(m-1-1.south east);
\path[font=\bfseries]
  (m-1-1.south west)node[above right]{Zähler}
  (m-1-1.north east)node[below left]{Nenner}
;
\foreach \r in {2,...,12}
  \draw(m.west|-m-\r-1.north)--(m-\r-1.north-|m.east);
\draw[thick]
  (m.west|-m.north)--(m.north-|m.east)
  (m.west|-m.south)--(m.south-|m.east)
  ;
\end{tikzpicture}
\end{document}

Verfasst: Do 14. Sep 2017, 09:05
von Milo
Ohje, stimmt, an die ganzen Pakete habe ich natürlich nicht gedacht.
Hätte mir eigendlich klar sein sollen.

Das es keine dokument umgebung gibt wundert mich jetzt echt, in der Stielvorlage, die man mir gesendet hat wird nur mit dieser Umgebung gearbeitet. Kann es sein, dass die speziell dafür geschaffen wurde (zumal sie bei mir funktioniert)?

Ich habe mir mal eure Code-Vorschläge kopiert und angeschaut.
Das war was ich mir vorgestellt habe.
Danke für eure Mühe.
Meine naive Vorstellung war nun, dass ich (zumindest in der TikZ - Variante)
Punte festlegen kann. Zwischen diesen wollte ich eine PfeilLinie ziehen.

\ draw (a_{11}) -- (a_{01})

Aber das habe ich mir wohl zu einfach vorgestellt.
Package pgf Error: No shape named a_{11} is known. \draw (a_{11})

Muss ich den Start - und Endstellen erst einen unsichtbaren Punkt zuordnen
und dann mit diesen arbeiten?

Gruß
Milo

Verfasst: Do 14. Sep 2017, 09:35
von markusv
Milo hat geschrieben:Muss ich den Start - und Endstellen erst einen unsichtbaren Punkt zuordnen
und dann mit diesen arbeiten?
Das hat die Matrix schon gemacht. Du musst lediglich die richtige Syntax anwenden. Die Tabellenlinien (siehe letzte Zeilen im TikZ-Beispiel von esdd) basieren bereits auf den Ankern, die dadurch gesetzt wurden.

Probier bspw.
\draw[thick,->](m-2-2.east)--(m-10-5.west);%Pfeillinie von 2.Zeile/2.Spalte rechts nach 10.Zeile/5.Spalte links
oder
\draw[thick,->](m-2-2.east)--(m-11-2.east);%von a_11 rechts nach a_0 rechts

Verfasst: Fr 15. Sep 2017, 10:09
von Milo
Oh danke Dir darauf konnte ich nun die restlichen Tabellen dieser Art aufbauen, das war echt super.

In meiner letzten Tabelle wollte ich die Zähler/Nenner Angaben durch das Symbol für natürliche Zahlen ersetzen.
Ich dachte, da \ usepackage{amsmath} eingebunden ist sollte dies durch $ \ mathbb{N} $ möglich sein aber leider sagt mir der Writer dies wäre eine undefinierte Kontrollfrequenz?
Muss ich hier in einer Tabelle etwas spezifisches beachten?

Nochmal vielen Dank für deine Hilfe, ohne Die wäre ich volkommen aufgeschmissen gewesen.
Grüße
Milo

Verfasst: Fr 15. Sep 2017, 10:20
von esdd
Lade noch amsfonts oder amssymb. Beachte außerdem, dass der Zellinhalt durch matrix of math nodes bereits im Mathemodus gesetzt wird. Verwende also nur \mathbb{N}.

Danke

Verfasst: Sa 16. Sep 2017, 09:15
von Milo
Nochmals ein dickes Dankeschon an Alle.

Verfasst: So 17. Sep 2017, 13:21
von esdd
Falls Deine Frage damit beantwortet ist, kannst Du bitte noch den Status entsprechend anpassen?