3

Is it possible create a system of equations that will look like this:

aX(x_0)+bX(x_0)+cX(x_0)=A
dX(x_1)+eX(x_1)+fX(x_1)=B
.........................
gX(x_n)+hX(x_n)+iX(x_n)=B

I tried with this:

    \documentclass[a4paper,12pt,twoside]{article}

    \usepackage{amsmath,amssymb,amsthm,amssymb}

    \usepackage{tikz}
    \usetikzlibrary{decorations.shapes}

    \begin{document}

    \begin{equation*}
    \begin{split}
    a_0\varphi_0(x_0)+a_1\varphi_1(x_0)+\ldots+a_n\varphi_n(x_0)&=f_0\\
    a_0\varphi_0(x_1)+a_1\varphi_1(x_1)+\ldots+a_n\varphi_n(x_1)&=f_1\\
    \begin{tikzpicture}
    \draw[decorate sep={0.4mm}{2mm},fill] (6,0) -- (12,0);
    \end{tikzpicture}
    a_0\varphi_0(x_n)+a_1\varphi_1(x_n)+\ldots+a_n\varphi_n(x_n)&=f_n\\
    \end{split}
    \end{equation*}
    \end{document}

But that isn't working : I could just put \cdots or some similar dots, but I'd like a continuous line across the row.

6

you can treat the alignment as an array, and use \hdotsfor (defined by amsmath):

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begingroup
\setlength{\arraycolsep}{0pt}
\begin{equation*}
\begin{array}{rl}
 a_0\varphi_0(x_0)+a_1\varphi_1(x_0)+\ldots+a_n\varphi_n(x_0)&{}=f_0\\
 a_0\varphi_0(x_1)+a_1\varphi_1(x_1)+\ldots+a_n\varphi_n(x_1)&{}=f_1\\
 \hdotsfor{2}\\
 a_0\varphi_0(x_n)+a_1\varphi_1(x_n)+\ldots+a_n\varphi_n(x_n)&{}=f_n\\
\end{array}
\end{equation*}
\endgroup

\end{document}

output of example code

since it's necessary to reset \arraycolset to zero, that needs to be hidden within a group. although you could use { ... }, unless you put a % after the closing brace, a line of text that follows directly after will be indented by one space; i used \begingroup ... \endgroup to take advantage of the fact that the space (or end of line) following \endgroup will be ignored.

of course, this won't work if you want the lines numbered individually.

  • 2
    All the answers are great! I don't need numbering, so it's great. I've chosen this as correct, it seemed like the easiest to implement :D (no tikz needed). Thank you all, you all got an upvote :D – dingo_d May 18 '13 at 18:08
4

This is an option:

\documentclass[a4paper,12pt,twoside]{article}

\usepackage{amsmath,amssymb,amsthm,amssymb}

\begin{document}

\begin{displaymath}
\begin{array}{*{3}{c@{\;+\:}}c@{\;=\;}c}
a_{1,1}x_{1} & a_{1,2}x_{2} & \cdots & a_{1,n}x_{n} & b_1 \\ 
a_{2,1}x_{1} & a_{2,2}x_{2} & \cdots & a_{2,n}x_{n} & b_2 \\ 
\multicolumn{5}{c}{\dotfill} \\
a_{n,1}x_{1} & a_{n,2}x_{2} & \cdots & a_{n,n}x_{n} & b_n \\ 
\end{array}
\end{displaymath}

\end{document}

enter image description here

1

How to draw a line of dots in tikz shows how to draw such a line. Maybe another alternative would be to use hdashrule from the dashrule package?

\intertext{\hdashrule{8cm}{1pt}{1mm 1mm}}

instead of the tikzpicture may be good enough but still requires a hard-coded width.

1

Here's a solution using TikZ with your settings. Simply put some marks at the start and ending of the previous line and then use \mdotteline for those marks:

\documentclass[a4paper,12pt,twoside]{article}
\usepackage{amsmath,amssymb,amsthm,amssymb}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand\tikzmark[1]{%
  \tikz[remember picture,overlay]\coordinate (#1);}
\newcommand\mdottedline[2]{%
\begin{tikzpicture}[remember picture,overlay]
\path let \p1=(#1), \p2=(#2) in
  node [text width=\x2-\x1]  at ( $ ([yshift=-\baselineskip]#1)!0.5!([yshift=-\baselineskip]#2) $ ) {\dotfill};
\end{tikzpicture}
}

\begin{document}

\begin{equation*}
\begin{split}
a_0\varphi_0(x_0)+a_1\varphi_1(x_0)+\ldots+a_n\varphi_n(x_0)&=f_0\\
\tikzmark{start}a_0\varphi_0(x_1)+a_1\varphi_1(x_1)+\ldots+a_n\varphi_n(x_1)&=f_1\tikzmark{end}
\\ \\
a_0\varphi_0(x_n)+a_1\varphi_1(x_n)+\ldots+a_n\varphi_n(x_n)&=f_n
\end{split}
\end{equation*}

\begin{align}
a_0\varphi_0(x_0)+a_1\varphi_1(x_0)+\ldots+a_n\varphi_n(x_0)&=f_0\\
\tikzmark{starti}a_0\varphi_0(x_1)+a_1\varphi_1(x_1)+\ldots+a_n\varphi_n(x_1)&=f_1\tikzmark{endi}
\\ \notag\\
a_0\varphi_0(x_n)+a_1\varphi_1(x_n)+\ldots+a_n\varphi_n(x_n)&=f_n
\end{align}

\mdottedline{start}{end}
\mdottedline{starti}{endi}

\end{document}

enter image description here

As the example shows, this works whether you number your lines or not.

  • This one is great if I need numbered lines separately :) – dingo_d May 18 '13 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.