居中表格阵列中的多行

居中表格阵列中的多行

有人能帮我在下一个文档的所有三行中生成三角形吗?我使用 \multirow 的所有尝试都失败了。

\documentclass{article}

\usepackage[utf8]{inputenc} % accents
\usepackage{verbatim} % \comment
\usepackage{amsmath,amssymb}
\usepackage{bm} % bold math
\usepackage{multirow,tabularx}
\usepackage{array}   % \newcolumntype 
\newcolumntype{x}[1]{ >{} m{#1} <{} }
\newcolumntype{X}[1]{ >{\[} m{#1} <{\]} }
%\newcolumntype{A}{>{$\begin{aligned}}c{\end{aligned}$}}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}

\tikzstyle{ciangle}=[
    every pic quotes/.append style={text=cyan},
    draw=cyan,
    angle radius=1cm,
  ]
\tikzstyle{sqangle}=[
    every pic quotes/.append style={text=cyan},
    draw=cyan,
    angle radius=1cm,
  ]

\newcommand{\DrawTriangle}[4]{% 
\begin{tikzpicture}  
  \coordinate (A) at (-1.5,-1);
  \coordinate (C) at (1.5,-1);
  \coordinate (B) at (1.5,1);
  \draw (C) -- node[right] {#1} (B) -- node[above] {#3} (A) -- node[below] {#2} (C);
  \pic [ciangle, "#4"] {angle=C--A--B};
%  \pic [ciangle, "#5"] {angle=A--B--C};
  \draw [sqangle](C) rectangle ++(-0.5,0.5);
\end{tikzpicture}
}

\begin{document}


\begin{tabular}{x{3cm} X{1cm}}
\DrawTriangle{$a$}{$b$}{$c$}{$\alpha$} & \textit{sen}(\alpha)=\frac{a}{c} \\
& \textit{cos}(\alpha)=\frac{b}{c} \\
& \textit{tan}(\alpha)=\frac{a}{b}=\frac{\textit{sin}(\alpha)}{\textit{cos}(\alpha)} \\
\end{tabular} 

\end{document}

在此处输入图片描述

另一个例子是:

\documentclass{article}

\usepackage[utf8]{inputenc} % accents
\usepackage{verbatim} % \comment
\usepackage{amsmath,amssymb}
\usepackage{bm} % bold math
\usepackage{array}   % \newcolumntype 
\newcolumntype{x}[1]{ >{} m{#1} <{} }
\newcolumntype{X}[1]{ >{\[} m{#1} <{\]} }
\usepackage{tikz}
\usetikzlibrary{angles,quotes}

\tikzstyle{ciangle}=[
    every pic quotes/.append style={text=cyan},
    draw=cyan,
    angle radius=0.75cm,
  ]
\tikzstyle{sqangle}=[
    every pic quotes/.append style={text=cyan},
    draw=cyan,
  ]

\newcommand{\DrawTriangle}[4]{% 
\begin{tikzpicture}[scale=0.5]
  \coordinate (A) at (-1.5,-1);
  \coordinate (C) at (1.5,-1);
  \coordinate (B) at (1.5,1);
  \draw [sqangle](C) rectangle ++(-0.5,0.5);
  \draw (C) -- node[right] {#1} (B) -- node[above] {#3} (A) -- node[below] {#2} (C);
  \pic [ciangle, "#4"] {angle=C--A--B};
%  \pic [ciangle, "#5"] {angle=A--B--C};
\end{tikzpicture}
}

\begin{document}

\begin{tabular}{|x{4cm}|x{2cm}|x{3cm}|}
\hline 
Conocemos la longitud de dos lados, buscamos la longitud del tercer lado. & \DrawTriangle{$a$}{$b$}{$c?$}{}{} & Teorema Pitagoras \newline $ c^2=a^2+b^2 $ \\
 & \DrawTriangle{$a?$}{$b$}{$c$}{} &  \\ 
 & \DrawTriangle{$a$}{$b?$}{$c$}{} &  \\
\hline 
\end{tabular} 

\end{document}

在此处输入图片描述

答案1

在此处输入图片描述

\documentclass{article}

\usepackage[utf8]{inputenc} % accents
\usepackage{verbatim} % \comment
\usepackage{amsmath,amssymb}
\usepackage{bm} % bold math
\usepackage{array}   % \newcolumntype 
\newcolumntype{x}[1]{ >{} m{#1} <{} }
%\newcolumntype{A}{>{$\begin{aligned}}c{\end{aligned}$}}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}

\tikzstyle{ciangle}=[
    every pic quotes/.append style={text=cyan},
    draw=cyan,
    angle radius=1cm,
  ]
\tikzstyle{sqangle}=[
    every pic quotes/.append style={text=cyan},
    draw=cyan,
    angle radius=1cm,
  ]

\newcommand{\DrawTriangle}[4]{% 
\begin{tikzpicture}  
  \coordinate (A) at (-1.5,-1);
  \coordinate (C) at (1.5,-1);
  \coordinate (B) at (1.5,1);
  \draw (C) -- node[right] {#1} (B) -- node[above] {#3} (A) -- node[below] {#2} (C);
  \pic [ciangle, "#4"] {angle=C--A--B};
%  \pic [ciangle, "#5"] {angle=A--B--C};
  \draw [sqangle](C) rectangle ++(-0.5,0.5);
\end{tikzpicture}
}

\begin{document}


\begin{tabular}{x{3cm} x{2cm}}
\DrawTriangle{$a$}{$b$}{$c$}{$\alpha$} &
$\textit{sen}(\alpha)=\frac{a}{c}$% why \textit?

$\textit{cos}(\alpha)=\frac{b}{c}$

$\textit{tan}(\alpha)=\frac{a}{b}=\frac{\textit{sin}(\alpha)}{\textit{cos}(\alpha)} $
\end{tabular} 

\end{document}

第二列需要更宽才能显示不换行的棕褐色线,我将其设置为 2 厘米而不是 1 厘米,但我不知道您的实际文档中有多少空间,所以我没有将其设置得更宽。

您没有使用tabularx但已经加载了包,请注意,如果您加载tabularx但定义自己的X列类型,tabularx则如果不进行一些内部重新定义,它将无法工作。

相关内容