Matrix aus Textbuch in Latex

Tabellen und Grafiken erstellen und anordnen


BennyS
Forum-Anfänger
Forum-Anfänger
Beiträge: 10
Registriert: Mo 10. Okt 2016, 14:14

Matrix aus Textbuch in Latex

Beitrag von BennyS »

Hallo zusammen,
ich würde gerne eine Gleichung aus einem Textbuch in Vektorgrafik umwandeln bzw. in Latex einbauen.

Das Ziel ist diese Gleichung
[img]http://fs5.directupload.net/images/170521/r4yrlb2u.png[\img]

Mein bisheriger Code sieht wie folgt aus:
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{shapes.geometric,arrows.meta,arrows,matrix,positioning}

\begin{document}

\begin{tikzpicture}[
   matrixonlybox/.style = {
				draw,
				matrix of math nodes,
				very thick,
				align = center
				},
  vectorwithparens/.style = {
					matrix of math nodes,
					outer sep=0pt,
					left delimiter=(,
					right delimiter=)},%align=center
  vectorwithbraces/.style = {
					   matrix of math nodes, 
					  outer sep=0pt,
					  columnwidth/.style={minimum width = .25cm}, 
					  column 1/.style={columnwidth}, 
					  left delimiter=\{, 
					  right delimiter=\}
					  }] 

	
\node (assignment1) {=}; 

\matrix [vectorwithbraces, 
    left =  of assignment1 ] (velvector) { 
     \phantom{O}\\ 
    \widetilde u \\ 
     \phantom{O}\\ 
}; 
\matrix[matrixonlybox, 
left = of velvector](dampmatrix){
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
     \phantom{O} & D & \phantom{O}\\ 
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
     };
     
\node(left of = dampmatrix,)(plus1){+};

\matrix [vectorwithbraces, 
    left = of plus1] (accvector) { 
     \phantom{O}\\ 
    \widetilde u \\ 
     \phantom{O}\\ 
}; 

\matrix[matrixonlybox, 
left = of accvector](massmatrix){
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
     \phantom{O} & M & \phantom{O}\\ 
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
     };
     
\end{tikzpicture} 
\end{document}
Leider klappt das mit der Matrix Positionierung nicht so wie gedacht und ich habe keine Ahnung warum nicht :( Darüberhinaus hätte ich gerne die Vektoren ( in {} ) etwas schmaler. Habe aber auch noch nicht herausgefunden wie ich die spaltenbreite verringere :(

Könnte mir hier jemand bitte helfen?

Grüße
Benny


Bartman
Forum-Meister
Forum-Meister
Beiträge: 2466
Registriert: Do 16. Jul 2009, 21:41
Wohnort: Hessische Provinz

Beitrag von Bartman »

Bild

Du musst Deine Knoten bzw. Matrizen auch an der richtigen Stelle einhengen.
\documentclass[tikz, border=5pt]{standalone}
\usepackage{amsmath}
\usetikzlibrary{
	matrix,
	positioning
}

\begin{document}
\begin{tikzpicture}[
   matrixonlybox/.style = {
            draw,
            matrix of math nodes,
            very thick,
            align = center
            },
  vectorwithparens/.style = {
               matrix of math nodes,
               outer sep=0pt,
               left delimiter=(,
               right delimiter=)},%align=center
  vectorwithbraces/.style = {
                  matrix of math nodes, 
%                 outer sep=0pt,
                 inner xsep=-2pt,% <- eingefügt
                 columnwidth/.style={minimum width = .25cm}, 
                 column 1/.style={columnwidth}, 
                 left delimiter=\{, 
                 right delimiter=\}
                 }] 

\matrix[matrixonlybox](massmatrix){
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
     \phantom{O} & M & \phantom{O}\\ 
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
};

\matrix [vectorwithbraces, 
    right = 5mm of massmatrix] (velvector) { 
     \phantom{O}\\ 
    \widetilde u \\ 
     \phantom{O}\\ 
}; 
     
\node[right = 3mm of velvector](plus1){+};% Optionen brauchen eckige statt runde Klammern

\matrix[
	matrixonlybox,
	right = 1mm of plus1
](dampmatrix){
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
     \phantom{O} & D & \phantom{O}\\ 
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
};

\matrix [vectorwithbraces, 
    right = 5mm of dampmatrix] (accvector) { 
     \phantom{O}\\ 
    \widetilde u \\ 
     \phantom{O}\\ 
}; 

\node[right = 3mm of accvector](plus2){+};

\matrix[
	matrixonlybox,
	right = 1mm of plus2
](smatrix){
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
     \phantom{O} & S & \phantom{O}\\ 
     \phantom{O} & \phantom{O} & \phantom{O}\\ 
};

\matrix [vectorwithbraces, 
    right = 5mm of smatrix] (thirduvector) { 
     \phantom{O}\\ 
    \widetilde u \\ 
     \phantom{O}\\ 
};

\node [right = 4mm of thirduvector] (assignment1) {=}; 

\matrix [vectorwithbraces, 
    right = 4mm of assignment1] (pvector) { 
     \phantom{O}\\ 
    \widetilde p \\ 
     \phantom{O}\\ 
};
\end{tikzpicture} 
\end{document}
Dateianhänge
Gleichung-mit-Vektoren.png
Gleichung-mit-Vektoren.png (12.22 KiB) 2081 mal betrachtet
Zuletzt geändert von Bartman am Mi 7. Jun 2017, 17:37, insgesamt 1-mal geändert.

BennyS
Forum-Anfänger
Forum-Anfänger
Beiträge: 10
Registriert: Mo 10. Okt 2016, 14:14

Beitrag von BennyS »

vielen vielen dank!:)

Gast

Beitrag von Gast »

Ich schließe darauf, dass die Frage beantwortet ist. Bitte künftig selbst auf den korrekten Status achten.

Antworten