robjhyndman / JDS-quarto

Quarto template for ACM/IMS Journal of Data Science
1 stars 1 forks source link

Code Listings #2

Open cynthiahqy opened 4 months ago

cynthiahqy commented 4 months ago

Quarto code listings gives error \begin{codelisting} but I can't find where the environment is defined in the quarto latex partials

::: {#lst-stata-code}

``` {.stata filename="group-occupations.do"}
/*use "occupation.dta", clear*/
/* merged data occupation*/
/* professional, manager, teacher, assprofclerk, svcsales, armforces,
xefe, farmer, craftrademach, labourer, driver, notclass */

gen farmer=0
replace farmer=1 if occupn>6000 & occupn<7000

Example STATA script for merging multiple occupations into larger groups :::

Another example:
SELECT E.k as k, sum(E.w * S.x) as y

@lst-sql-matvec shows a query that does...

cynthiahqy commented 4 months ago

@robjhyndman can you please help me make this work? 😭 I've tried looking in the Quarto pandoc templates but I can't figure out where the codelisting environment is defined / generated. Maybe helpful:

robjhyndman commented 4 months ago

This is messy because pandoc and quarto both try to handle it in different ways. I've added an example to the template that seems to work ok. See https://github.com/robjhyndman/JDS-quarto/commit/7b23abbbe6b69d250ac704b61258aa3a8be2611e