Math & ScienceFractions and Matrices

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
remusmp
Posts: 25
Joined: Sat Oct 17, 2009 8:37 pm

Fractions and Matrices

Post by remusmp »

Hej,

I've made a matrix with lots of fractions inside. The problem is that the font size differs. Is there a nice way (some environment) that keeps the same font size? (I did it with \displaystyle but I don't want to type it every time I need it)

Code: Select all

\begin{equation}
	A=\left[
	\begin{array}{lcr}
		-\frac{\displaystyle k_vA_v}{\displaystyle 2A_t\sqrt{h_0}}&0&0\\
		-\frac{\displaystyle C_v}{\displaystyle A_th_0^2}\left[u_{1_0}\left(T_k-T_{u_0}\right)+u_{2_0}\left(T_v-T_{u_0}\right)\right]&-\frac{C_v}{A_th_0}\left(u_{1_0}+u_{2_0}\right)&0\\
		0&\frac{1}{\tau_m}&-\frac{1}{\tau_m}
	\end{array}
	\right]
\end{equation}
Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Fractions and Matrices

Post by localghost »

Include the array package and specify \displaystyle for every single column as shown below.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=3cm]{geometry}
\usepackage{array}

\begin{document}
  \begin{equation}
    A=\left[
    \begin{array}{>{\displaystyle}l>{\displaystyle}c>{\displaystyle}r}
      -\frac{k_vA_v}{2A_t\sqrt{h_0}} & 0 & 0 \\
      -\frac{C_v}{A_th_0^2}\left[u_{1_0}\left(T_k-T_{u_0}\right)+u_{2_0}\left(T_v-T_{u_0}\right)\right] & -\frac{C_v}{A_th_0}\left(u_{1_0}+u_{2_0}\right) & 0 \\
      0 & \frac{1}{\tau_m} & -\frac{1}{\tau_m}
    \end{array}
    \right]
  \end{equation}
\end{document}

Best regards
Thorsten
remusmp
Posts: 25
Joined: Sat Oct 17, 2009 8:37 pm

Re: Fractions and Matrices

Post by remusmp »

Thanks a lot. It works.
Post Reply