gentzkow / template_archive

20 stars 36 forks source link

Reformat template to fit `.tex` compile #86

Closed ShiqiYang2022 closed 1 year ago

ShiqiYang2022 commented 1 year ago

In this issue we will reformat the template to substitute from .lyX to .tex compile for our standard paper development process.

Goals of this issue:

This issue is originated from https://github.com/gentzkow/template/issues/84#issuecomment-1650960177 and is related to https://github.com/gentzkow/template/issues/85.

cc: @gentzkow @jc-cisneros @snairdesai

ShiqiYang2022 commented 1 year ago

@gentzkow

I have completed the tasks listed per https://github.com/gentzkow/template/issues/86#issue-1886725615 reformatting template to fit .tex compile. The draftable diff between the .tex compile and the original one is here.

There are two notes worth mentioning:

  1. gs.run_latex() need to be upgraded.

Currently run_latex doesn't handle the compilation of nested .tex structures when make.py and paper.tex reside in different directories. Here's why:

To solve this, I updated gs.run_latex() and metadata in this commit in https://github.com/gslab-econ/gslab_make/issues/64, and opened a pull request to merge into gslab_make/master.

  1. Difference between .tex compile locally vs. Overleaf compile can be properly managed.

Overleaf uses the latest version of TexLive to compile, and we can always shift to old TexLive versions. For details please refer to the official blog here. Fortunately our lab-manual also request using TexLive. So theoretically if we set the TexLive version in Overleaf consistent with our local end, we should not see difference between the outputs. The version control for lab member should not be a big issue.

The draftable diff using template between local and Overleaf compile is here, no difference found.

The only potential risk is some collaborators might use a different TeX distribution (e.g., MiKTeX). To trying avoid this, we can(and we should) use the packages that only are part of the standard TeX distribution and specify old package versions. This general idea is specified in Gentzkow and Shapiro(2014) so lab member should know that. For collaborators not familiar with our style of coding, even if they very unfortunately failed compile on local end, they always have plan B, i.e. do it on Overleaf; and this is way better than lyx -- if you fail to compile lyx, you do not have alternatives.


I am opening a PR(#88) of this issue, and once we merge both issue branches of template and gslab_make to master, the switch from lyx to .tex compile is finished. Please let me know for any of your thoughts. Thanks!

ShiqiYang2022 commented 1 year ago

Summary

In this issue we reformat the template to substitute from .lyX to .tex compile for our standard paper development process. We discussed how to manage the difference in https://github.com/gentzkow/template/issues/86#issuecomment-1768660960.

This thread continued in the associated PR (https://github.com/gentzkow/template/pull/88). The errors are addressed in #89, #90, https://github.com/gslab-econ/gslab_make/issues/64, and https://github.com/gslab-econ/gslab_make/pull/65 as follow-up issues and PRs.

Merged to master in c5f5695. Final state of issue branch here.