ijyliu / ECMA-31330-Project

Econometrics and Machine Learning Group Project
2 stars 1 forks source link

LaTeX Instructions for Paul #42

Closed ijyliu closed 3 years ago

ijyliu commented 3 years ago

@marionoro

First, note: you can't compile individual tables into pdfs, usually. You have to reference them in a main document usually. For an example, see what I did with the world bank regression tables. So what you will need to do is just make a \input block in the main paper .tex file.

How to compile LaTeX on your computer:

  1. Download and install mikTex here: https://miktex.org/
  2. Open the Tex file in TexWorks and click the green play button

If you want to compile from VSCode (@nicomarto just set this up for himself I think)

  1. Get the LaTeX workshop extension
  2. Follow an answer here: https://tex.stackexchange.com/questions/462365/how-to-use-latex-on-vs-code . I followed the third one and downloaded Perl. But I think you can also follow the second one and switch the pdf rendering engine to something that doesn't use Perl.
paul-opheim commented 3 years ago

This all makes sense. I thought that we had to create PDFs of the .tex table files first, but I now see that that is not the case. However, I am not sure how I can compile the main LaTeX file on my computer when I do not have some of the figures that are referenced in the .tex file. Do I need to download the folder containing all the figures and tables before I compile my PDF file?

ijyliu commented 3 years ago

Yes

On Tue, May 18, 2021 at 2:11 PM marionoro @.***> wrote:

This all makes sense. I thought that we had to create PDFs of the .tex table files first, but I now see that that is not the case. However, I am not sure how I can compile the main LaTeX file on my computer when I do not have some of the figures that are referenced in the .tex file. Do I need to download the folder containing all the figures and tables before I compile my PDF file?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ijyliu/ECMA-31330-Project/issues/42#issuecomment-843413701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQCGE4LFYFAYK3EJI7CADY3TOKUVZANCNFSM45BKHMVQ .

paul-opheim commented 3 years ago

How do I download a folder from Github lol. I don't see any button for doing that.

ijyliu commented 3 years ago

Git pull

On Tue, May 18, 2021 at 2:20 PM marionoro @.***> wrote:

How do I download a folder from Github lol. I don't see any button for doing that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ijyliu/ECMA-31330-Project/issues/42#issuecomment-843418895, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQCGE4OCODBE6L64HH6JHUTTOKVVNANCNFSM45BKHMVQ .

ijyliu commented 3 years ago

You should use git pull to pull the copy of the repository from GitHub and git add, git commit -m “message” and git push to send your local copy to GitHub

Are you using GitHub desktop or soemthing or VSCode? Instead of running the commands there should be buttons somewhere

On Tue, May 18, 2021 at 2:20 PM Isaac Liu @.***> wrote:

Git pull

On Tue, May 18, 2021 at 2:20 PM marionoro @.***> wrote:

How do I download a folder from Github lol. I don't see any button for doing that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ijyliu/ECMA-31330-Project/issues/42#issuecomment-843418895, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQCGE4OCODBE6L64HH6JHUTTOKVVNANCNFSM45BKHMVQ .

paul-opheim commented 3 years ago

I've just been using the website. I'll download GitHub Desktop.

ijyliu commented 3 years ago

yeah that should make your life 100x easier

paul-opheim commented 3 years ago

image

When I try to run the main .tex file, it gets caught when it says this message. Any idea what that means?

ijyliu commented 3 years ago

Yeah latex is notoriously not transparent with respect to errors. I think there's possibly something wrong with your table? Or, maybe we are missing the package for \textit and need to \use that

ijyliu commented 3 years ago

If you can't figure it out, try to turn problematic things off and get a minimal working example, then build up from there

ijyliu commented 3 years ago

Ugh making this table is annoying but try this: https://www.tablesgenerator.com/

I think in the original case you had the wrong number of columns or something, the code for the regression tables I made with stargazer has like 6 columns not 5

This also seems promising: https://jeltef.github.io/PyLaTeX/current/pylatex/pylatex.table.html

another big example

\begin{table}[p!]
\caption{Effects of AI Exposure on Establishment AI Vacancy Growth, 2010-2018
}
\label{tab:ai_growth}
\resizebox{\linewidth}{!}{\begin{tabular}{L{4cm}C{2.5cm}C{2.5cm}C{2.5cm}C{2.5cm}C{2.5cm}C{2.5cm}} \toprule
            & \multicolumn{6}{c}{Growth of Establishment AI Vacancies, 2010-2018} \\ 
            \cmidrule(r){2-7}

            &(1) &(2) &(3) & (4) &(5) &(6)  \\\midrule

            &\multicolumn{6}{c}{\textsl{Panel A:} Felten et al. Measure of AI Exposure}\\
            \input{Tables/ai_growth_felten2010.tex}
            \\[-2mm]

            &\multicolumn{6}{c}{\textsl{Panel B:} Webb Measure of AI Exposure}\\
            \input{Tables/ai_growth_webb2010.tex}
            \\[-2mm]    

            &\multicolumn{6}{c}{\textsl{Panel C:} SML Measure of AI Exposure}\\
            \input{Tables/ai_growth_sml2010.tex}
            \\[-2mm]

            \textit{Covariates:}

            Share of Vacancies in Sales \& Admin, 2010 & & & & & $\checkmark$ & $\checkmark$ \\

            \textit{Fixed Effects:} \\ 

            Firm Size Decile & & $\checkmark$ & $\checkmark$ & & $\checkmark$ & \\
            Commuting Zone & & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$ \\ 
            3 digit Industry & & & $\checkmark$ & & $\checkmark$ & \\ 
            Firm & & & & $\checkmark$ & & $\checkmark$ \\ 

            \bottomrule \\
    \end{tabular}}  {\footnotesize This table presents estimates of the effects
of establishment AI exposure on establishment AI vacancy growth. The outcome
variable, constructed from Burning Glass data, is the growth rate of AI
vacancies between 2010 and 2018, multiplied by 100. We approximate this
growth rate with the change in the inverse hyperbolic sine of the number of
vacancies posted by the establishment in 2010-12 and 2016-18. The regressor,
establishment AI exposure in 2010, is the mean of occupation AI exposure,
over the 6 digit SOC occupations for which the establishment posts vacancies
in 2010-2012, weighted by the number of vacancies posted per occupation.
Establishment AI exposure is divided by the standard deviation, weighted by
2010-12 vacancies. In Panel A, the measure of occupation AI exposure is from
Felten et al. (2019). In Panel B, the measure of occupation AI exposure is
SML, from Brynjolfsson et al. (2019). In Panel C, the measure of occupation
AI exposure is from Webb (2020). All columns exclude establishments in NAICS
sectors 51 (Information) and 54 (Business Services). The covariates included
in each model are reported at the bottom of the table. Column 1 contains
only establishment AI exposure. Columns 2-3 and 5 include fixed effects for
the decile of firm total vacancies in 2010-12 to which the establishment's
firm belongs. Columns 2-6 include commuting zone fixed effects. Columns 3
and 5 include 3 digit NAICS industry fixed effects. Columns 4 and 6 include
firm fixed effects. Columns 5 and 6 control for the share of 2010-12
vacancies in each establishment, belonging to the broad occupations of
either sales or administration. In each regression, observations are
weighted by total vacancies in 2010-2012. Standard errors are clustered by
firm. One, two and three asterisks denote significance at the 10, 5 and 1
percent level.}
\end{table}

image

paul-opheim commented 3 years ago

Oh, I was able to make the needed tables. I'm not sure if an automated method would be necessary given that I don't think we'll have to remake the tables too many times.

ijyliu commented 3 years ago

The problem is that there is an error in the tables which is stopping the pdf from compiling. so nothing will update

this is why latex is a pain

paul-opheim commented 3 years ago

Oh, it compiled for me (I ended up using Overleaf lol).

ijyliu commented 3 years ago

Ok, please push then

paul-opheim commented 3 years ago

What do you mean? The PDF and Tex files in the Release folder are the ones with my recent changes

paul-opheim commented 3 years ago

I think I changed the links in the main Tex file back to what they should be to work on GitHub...

ijyliu commented 3 years ago

I mean for the tables themselves, the .tex files are causing problems that stop things from compiling

paul-opheim commented 3 years ago

Huh, weird. They compile totally fine on Overleaf.

paul-opheim commented 3 years ago

But to respond to what you said earlier, I made those tables by taking preexisting .tex code that you had created (using Stargazer), but then deleted one column from the tables, so that fits with your comment about there being 5 columns instead of 6. I'm not sure why that would cause them to no longer compile with MikTex.

ijyliu commented 3 years ago

Do the latest versions on github compile for your MikTex?

ijyliu commented 3 years ago

Did you update the versions of the table .tex files on GitHub

paul-opheim commented 3 years ago

The latest version on github do not compile on MikTex (I get that same mysterious error that I mentioned earlier in this thread). I actually got annoyed with how MikTex wasn't compiling, and so I just uploaded all the files from Github onto an Overleaf and then compiled the same code there, and it worked immediately (I re-did that just now and it still works).

Basically, when I upload these same table .tex files to an Overleaf file, the file compiles without any issue.

paul-opheim commented 3 years ago

I'm wondering if it would be easier to just switch to Overleaf? We keep the Issues on Github for communication's/posterity's sake, but we use Overleaf as our compiler and our storage for tex and pdf files that will be used in our main document?

ijyliu commented 3 years ago

I fixed the bug, it was incredibly stupid. You have to put $ signs around math like \rho and \beta_1.

Changed & \multicolumn{5}{c}{\textit{True \beta_2}} \ to & \multicolumn{5}{c}{\textit{True $\beta_2$}} \ for example.

paul-opheim commented 3 years ago

Oh lol. That'll do it.