4

**Second edit: I changed the title to make sure I didn't confuse anybody. After seeing everybody's comments, I have realized where I was confusing about.

  1. *What's the efficient way to make all the texts "\flushleft"? Problem solved. Thanks to @koleygr(see the first answer, comment 1)
  2. *What's the efficient way to "style" all the elements of a tabular instead of styling them individually? Problem solved. Ditto(comment 2).
  3. *What's the efficient way to create several new lines? Problem solved. Ditto(comment 3). More questions to be solved:
  4. How do I know how many inches or centimeter in \vspace? With experience?
  5. When I wrote \documentclass[12pt]{article}, does the font size differ from the font size in M$ Word? Because I was reinventing wheels from the document our professor gave to me, but the font size is not exactly the same.
  6. If inside a \(\) have some text which I don't want it to be italic, do I have to write \text{} every time?

How's everybody! I am going to university after this semester. I am a Math major and I want to learn LaTeX in advance. I have been learning LaTeX for a while and this is the first time writing Econ assignment using LaTeX.

How do you guys think about the code? Anything that needs improvement?

One thing I noticed while writing was the table I created is a little bit offset compared to other texts above. Is there any way to fix this?

Best wishes to all of you.

Here are my results: Page 1 Page 2

Here are my codes:

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\usepackage{mathptmx}

\begin{document}
\begin{flushleft}
\section*{\small \bfseries First Economic Assignment: GDP Deflator}
\subsection*{\small \bfseries Consumer Spending}
\begin{tabular}{l c c c c c}
\small \bfseries Goods/Services & \small \bfseries 2017 Quantity & \small \bfseries 2017 Price & \small \bfseries 2016 Quantity & \small \bfseries 2016 Price\\

\small Sushi & \small 625,000   & \small \$30.00 & \small 600,000 & \small \$28.00\\

\small Jamba Juice & \small 750,000 & \small \$5.35 & \small 700,000 & \small \$5.00\\

\small Samsung 4k Television & \small 50,000 & \small \$799.99 & \small 45,000 & \small \$749.99\\

\small Samsung Note 8 & \small 125,000 & \small\$199.99 & \small 100,000 & \small \$189.99
\end{tabular}
\newline \newline

\small Calculate the Nominal GDP for 2017.\\
\(\text{Norminal GDP}_{cs2017} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2017}} = 625,000 \times \$30.00+750,000 \times \$5.35+50,000 \times\$799.99+125,000 \times\$199.99 = \textbf{87,760,750}\)
\newline

\small Calculate the Real GDP with a base year of 2016.\\
\(\text{Real GDP}_{cs2016} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2016}} = 625,000 \times \$28.00+750,000 \times \$5.00+50,000 \times \$749.99+125,000 \times \$189.99 = \textbf{82,498,250}\)

\subsection*{\small \bfseries Government Spending}
\begin{tabular}{l c c c c c}
\small \bfseries Goods/Services & \small \bfseries 2017 Quantity & \small \bfseries 2017 Price & \small \bfseries 2016 Quantity & \small \bfseries 2016 Price\\

\small Public Schools & \small 1,000    & \small \$300 m & \small 950 & \small \$280 m\\

\small Highways & \small 250 & \small \$250 m & \small 200 & \small \$250 m\\

\small Medicare & \small 50,000 & \small \$700.00 & \small 45,000 & \small \$700.00\\

\small Social Security & \small 55,000 & \small\$1,200.00 & \small 100,000 & \small \$1,100.00
\end{tabular}
\newline \newline

\small Calculate the Nominal GDP for 2017.\\
\(\text{Norminal GDP}_{gs2017} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2017}} = 1,000 \times \$300 m+250 \times \$250 m+50,000 \times\$700.00+55,000 \times\$1,200.00 = \textbf{362,601,000,000}\)
\newline

\small Calculate the Real GDP with a base year of 2016.\\
\(\text{Real GDP}_{gs2016} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2016}} = 1,000 \times \$280 m+250 \times \$250 m+50,000 \times\$700.00+55,000 \times\$1,100.00 = \textbf{342,595,500,000}\)

\subsection*{\small \bfseries Investment Spending}
\begin{tabular}{l c c c c c}
\small \bfseries Goods/Services & \small \bfseries 2017 Quantity & \small \bfseries 2017 Price & \small \bfseries 2016 Quantity & \small \bfseries 2016 Price\\

\small Commercial Towers & \small 250   & \small \$500 m & \small 170 & \small \$480 m\\

\small Used Machinery & \small 850 & \small \$525 m & \small 700 & \small \$500 m\\

\small Condominiums & \small 350 & \small \$750 m & \small 245 & \small \$740 m\\

\small Business Parks & \small 225 & \small\$450 m & \small 100 & \small \$380 m
\end{tabular}
\newline \newline

\small Calculate the Nominal GDP for 2017.\\
\(\text{Norminal GDP}_{is2017} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2017}} = 250 \times \$500 m+850 \times \$525 m+350 \times\$750 m+225 \times\$450 m = 935000 m = \textbf{935,000,000,000}\)
\clearpage

\small Calculate the Real GDP with a base year of 2016.\\
\(\text{Real GDP}_{is2016} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2016}} = 250 \times \$480 m+850 \times \$500 m+350 \times\$740 m+225 \times\$380 m = 889500 m = \textbf{889,500,000,000}\)

\subsection*{\small \bfseries Net Exports}
\begin{tabular}{l c c c c c}
\small \bfseries Goods/Services & \small \bfseries 2017 Quantity & \small \bfseries 2017 Price & \small \bfseries 2016 Quantity & \small \bfseries 2016 Price\\

\small Technology & \small 1,000    & \small \$300,000 & \small 1,000 & \small \$280,000\\

\small Military Arms & \small 5,000 & \small \$25,000 & \small 7,000 & \small \$20,000\\

\small Textiles & \small 750,000 & \small \$49.99 & \small 845,000 & \small \$39.99\\

\small Toys & \small 925,000 & \small\$19.99 & \small 900,000 & \small \$18.99
\end{tabular}
\newline \newline

\begin{small}
Calculate the Nominal GDP for 2017.\\
\(\text{Norminal GDP}_{ne2017} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2017}} = 1,000 \times \$300,000+5,000 \times \$25,000+750,000 \times\$49.99 m+925,000 \times\$19.99 = \textbf{480,983,250}\)
\newline

Calculate the Real GDP with a base year of 2016.\\
\(\text{Real GDP}_{ne2016} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2016}} = 1,000 \times \$280,000+5,000 \times \$20,000+750,000 \times\$39.99 m+925,000 \times\$18.99 = \textbf{427,558,250}\)
\newline

Add all of the Nominal GDP for 2017.\\
\(\text{Nominal GDP}_{2017} = \text{Norminal GDP}_{cs2017} + \text{Norminal GDP}_{gs2017} + \text{Norminal GDP}_{is2017} + \text{Norminal GDP}_{ne2017} = 87,760,750 + 362,601,000,000 + 935,000,000,000 - 480,983,250 = \textbf{1,297,207,777,500}\)
\newline

Add all of the Real GDP with a base year of 2016.\\
\(\text{Real GDP}_{2017} = \text{Real GDP}_{cs2017} + \text{Real GDP}_{gs2017} + \text{Real GDP}_{is2017} + \text{Real GDP}_{ne2017} = 82,498,250 + 342,595,500,000 + 889,500,000,000 - 427,558,250 = \textbf{1,231,750,440,000}\)
\newline

Calculate the GDP Deflator.\\
\(\text{GDP Deflator} = \text{Nominal GDP} \div \text{Real GDP} \times 100 = 1,297,207,777,500 \div 1,231,750,440,000 \times 100 = \textbf{105.314172041}\)
\newline

Explain what is happening to the economy?\\

\end{small}
\end{flushleft}
\end{document}
  • 4
    I have to tell you that this is not the way that this site and forums work. If somebody will help you, it will be just a personal help to you. Nobody else will be helped by such a post. If you have some specific problem you may ask about thet, so that next visitors or some google search will lead to your question and help others too. [A payed service -like freelancer sites- are appropriate for such jobs... but not a forum] – koleygr Feb 28 '18 at 23:29
  • for table "fix": \begin{tabular}{@{} l c c c c c} (but this "off-set is intentional) , all others is opinion based ... if you first like to master table settings, read some introductory text about tables as en.wikibooks.org/wiki/LaTeX/Tables and search through this site for tag tables. – Zarko Feb 28 '18 at 23:43
  • \section*{\small \bfseries First Economic Assignment: GDP Deflator} Section etc. headings are using \bfseries (or bold font) already, however, they are not using \small inside by default – user31729 Feb 28 '18 at 23:53
  • @koleygr I don't entirely agree. We have other questions of this general kind and nobody raises any objections. The main difference, as far as I can tell, is that those questions generally involve more experienced users whose code is typically more sophisticated in some way. But I can't see why the level of an OP's expertise should determine whether or not such a request is considered a resonable one for this site. And, anyway, SE is adamant that its sites are NOT forums. – cfr Mar 1 '18 at 0:56
  • @cfr My comment was about asking more specific question. I haven't really found many questions in style "How to improve this code" that are accepted or that have no objection. (But possibly this just happened). "How to improve this table" is a usual question but it is about something more specific. "Suggested way for left align text" also. So, my objection was about the future value of the question, not of the expertise of the OP. Also I didn't flag it... just added a comment to help the OP to ask more valuable (for every user) questions. Even not a forum I thought SE uses this philosophy too. – koleygr Mar 1 '18 at 1:06
2

Just some fixes of the first lines of your document:

(I used common ways as far as this can be said)

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\usepackage{mathptmx}
\usepackage{parskip}%See Comment 1
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\usepackage{array}%See Comment 2
\newcolumntype{G}{>{\small}c}
\usepackage{bm}%See Comment 5
\usepackage{titlesec}%See comment 1.5
\titleformat*{\section}{\bfseries\small}
\titleformat*{\subsection}{\bfseries\small}
\begin{document}
%Comment 1
%\begin{flushleft} No needed and not really correct
% Added parskip package and \setlength{\parindent}{0pt} for this
% Also used \setlength\parindent{0pt} to let you use empty line instead of \\ 
\section*{First Economic Assignment: GDP Deflator}%Used titlesec package to set a style for sections and subsections 
\subsection*{Consumer Spending}
\begin{tabular}{>{\small}l *{5}{G}}%Comment 2
  %Added \small in every comumn and
  %automated c columntype insertion to *{5}{G}
  %G is a newcolumntype defined above by array package usega
  %See also sunitx package too for S column type that can align numbers to their dot
  \bfseries Goods/Services & \bfseries 2017 Quantity &  \bfseries 2017 Price &\bfseries  2016 Quantity &  \bfseries2016 Price\\
  %Removed all \small because of added command in columntype
Sushi &  625,000   &  \$30.00 &  600,000 &  \$28.00\\

 Jamba Juice &  750,000 &  \$5.35 &  700,000 &  \$5.00\\

 Samsung 4k Television &  50,000 &  \$799.99 &  45,000 &  \$749.99\\

 Samsung Note 8 &  125,000 & \$199.99 &  100,000 &  \$189.99
\end{tabular}
%Comment 3
%\newline \newline
%Replaced above with vspace
\vspace{2\baselineskip}

\small Calculate the Nominal GDP for 2017.



%Comment 4: Replaced with below and removed \newline
%\(\text{Norminal GDP}_{cs2017} = \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2017}} = 625,000 \times \$30.00+750,000 \times \$5.35+50,000 \times\$799.99+125,000 \times\$199.99 = \textbf{87,760,750}\)
%\newline
% Doesn't needed

%used align
\begin{align*}
  \text{Normal GDP}_{cs2017} &= \sum{\text{Quantity}_{2017} \cdot \text{Price}_{2017}}\\& = 625,000 \times \$30.00+750,000 \times \$5.35+50,000 \times\$799.99+125,000 \times\$199.99 \\&= \bm{87,760,750}%Comment 5 Used \bm command for bold math instead of \textbf
\end{align*}


\end{document}

The rest seems ok (You may be want to add @{} in table arguments as @Zarco suggested)

Output:

enter image description here

| improve this answer | |
  • I believe it should be \textbf{entry}, not \bfseries entry. – Teepeemm Mar 1 '18 at 1:41
  • @Teepeemm It doesn't matter in a tabular cell as it is limited to that scope anyway. – cfr Mar 1 '18 at 1:45

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.