6
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
First find how many days between July 22 and Nov 4
    \[\begin{tabular}{|ccc|}
    \hline 
    Month &       & days \\
    \hline \hline
    July  &  31-22  & 9 \\
    August &       & 31 \\
    September &       & 30 \\
    October &&31\\
    November&&4\\
    \hline \hline
    \multicolumn{2}{|c}{total } & 105 days \\
    \hline
   \end{tabular}\]

\begin{flalign*} 
PV &= \frac{FV}{1+r \times t} \\\\
 &= \frac{1000}{\left(1+0.07 \times \frac{105}{365}\right)} \\\\
 &= \dfrac{2000}{1.020137}\\\\
 &= \$980.26
\end{flalign*}
\end{document}

I would like to keep everything to the left, but currently the table is centred.

1
  • Welcome to TeX.sx! Usually, we don't put a greeting in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. – Andrew Uzzell Oct 29 '12 at 13:39
5

Since you have defined a table inside a display equation(!), you may use fleqn as the option for the documentclass.

\documentclass[12pt,a4paper,fleqn]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\setlength\mathindent{0pt} %% reduce the indent for equations to 0pt.
\begin{document}
First find how many days between July 22 and Nov 4
    \[\begin{tabular}{|ccc|}
    \hline
    Month &       & days \\
    \hline \hline
    July  &  31-22  & 9 \\
    August &       & 31 \\
    September &       & 30 \\
    October &&31\\
    November&&4\\
    \hline \hline
    \multicolumn{2}{|c}{total } & 105 days \\
    \hline
   \end{tabular}\]

    \begin{flalign*}
PV &= \frac{FV}{1+r \times t} \\\\
 &= \frac{1000}{\left(1+0.07 \times \frac{105}{365}\right)} \\\\
 &= \dfrac{2000}{1.020137}\\\\
 &= \$980.26
\end{flalign*}
\end{document}

enter image description here

Update:

Now it is time to do things in right way. tabular need not be used inside \[...\]. And as noted by Gonzalo, instead of using double \\ to leave some extra vertical space between equations, one can use the optional argument like\\[<len>], where <len> can be \jot or any unit of length like pt or cm or multiples of baselineskip as in this example, where nothing is changed in the preamble:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}    
\begin{document}

First find how many days between July 22 and Nov 4
\par\noindent
\begin{tabular}{|ccc|}
    \hline
    Month &       & days \\
    \hline \hline
    July  &  31-22  & 9 \\
    August &       & 31 \\
    September &       & 30 \\
    October &&31\\
    November&&4\\
    \hline \hline
    \multicolumn{2}{|c}{total } & 105 days \\
    \hline
\end{tabular}
here
\begin{flalign*}
    PV  &= \frac{FV}{1+r \times t} && \\[\jot]
        &= \frac{1000}{\left(1+0.07 \times \dfrac{105}{365}\right)} && \\[.5cm]
        &= \dfrac{2000}{1.020137} && \\[\baselineskip] 
        &= \$980.26 &&
\end{flalign*}
\end{document}
4
  • There's no need to use \[...\] for the table. A simple \par\noindent before \begin{tabular} will do. Also, instead of using \\\\ to increase the spacing, you could suggest changing \jot. – Gonzalo Medina Oct 29 '12 at 13:32
  • Harish Is is possible that nothing outside {document} environment is modified? the preamble must be left as it is, otherwise all my other notes will be modified too. – Ben Oct 29 '12 at 13:49
  • @GonzaloMedina: I missed totally, Sorry. Updated the answer. – user11232 Oct 29 '12 at 14:30
  • @user21494: See the update above where nothing is changed in the preamble. – user11232 Oct 29 '12 at 14:31
3

If you really want left alignment (which doesn't seem too good), then you can do like this:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
First find how many days between July 22 and Nov 4
\begin{flalign*}\settowidth{\dimen0}{$PV$}
  \makebox[\dimen0][l]{\begin{tabular}{|ccc|}
    \hline
    Month &   & days \\
    \hline \hline
    July  &  31-22  & 9 \\
    August &       & 31 \\
    September &       & 30 \\
    October &&31\\
    November&&4\\
    \hline \hline
    \multicolumn{2}{|c}{total } & 105 days \\
    \hline
 \end{tabular}}&&&\\[\jot]
PV &= \frac{FV}{1+r \times t} &&\\[\jot]
 &= \frac{1000}{\left(1+0.07 \times \frac{105}{365}\right)} &&\\[\jot]
 &= \frac{2000}{1.020137}&&\\[\jot]
 &= \$980.26&&\vphantom{\frac{\mathstrut}{\mathstrut}}
\end{flalign*}
\end{document}

The tabular is set to have an apparent width equal to "PV". Instead of "empty lines" it's better to give a small amount of space (\jot, which can also be 2\jots or 1.5\jots or whatever, take your pick). In order to get left alignment you have to add another "fake" column, represented by the final &&.

2

You have used table inside display equation. If you remove that then table will automatically come to left side. and for equation you can use && at the end of the line to bring it to left. Here is the code:

\documentclass[12pt,a4paper]{article}  
\usepackage[utf8]{inputenc}  
\usepackage{amsmath}  
\usepackage{amsfonts}  
\usepackage{amssymb}  
\usepackage{graphicx}  
\begin{document}  

First find how many days between July 22 and Nov 4\\\\  
   \begin{tabular}{|lll|}  
    \hline   
    Month &       & days \\   
    \hline \hline  
    July  &  31-22  & 9 \\  
    August &       & 31 \\  
    September &       & 30 \\  
    October &&31\\  
    November&&4\\  
    \hline \hline  
    \multicolumn{2}{|c}{total } & 105 days \\  
    \hline  
   \end{tabular}  
    \begin{flalign*}   
PV &= \frac{FV}{1+r \times t} && \\\\  
 &= \frac{1000}{\left(1+0.07 \times \frac{105}{365}\right)} && \\\\  
 &= \dfrac{2000}{1.020137} && \\\\  
 &= \$980.26 &&  
\end{flalign*}  
\end{document}  

Hope this will help.

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.