Skip to content

Instantly share code, notes, and snippets.

View zepinglee's full-sized avatar

Zeping Lee zepinglee

  • Beijing, China
  • 19:27 (UTC +08:00)
View GitHub Profile
@zepinglee
zepinglee / latex2e-style-guide.md
Created December 18, 2021 13:06
LaTeX2e 编码风格指南

LaTeX2e 编码风格指南

本文提供的编码规范适用于使用 LaTeX2e 撰写的文档代码,主要目的是为了提升代码的可读性,减少可能的错误。 本指南不适用于 LaTeX2e 宏包(.sty)和文档类(.cls)以及 LaTeX3 的代码(应参考 “LaTeX3 style guide”)。

如果项目有自己的编码风格指南,优先使用该项目特定的指南。

代码布局

缩进

With citperoc-js:

  • Copy punctuation_ColonOutsideQuotation.txt to fixtures/local/punctuation_ColonOutsideQuotation.txt.
  • Run cslrun -s punctuation_ColonOutsideQuotation.txt.

With pandoc: pandoc -t plain --citeproc --csl=modified-chicago-17th.csl < colon-outside-quotation-fixture.md

from collections import Counter
import glob
import os
import xml.etree.ElementTree as ET
# from lxml import etree as ET
import yaml
CSL_STYLES_DIR = '../styles'
NSMAP = {'cs': 'http://purl.org/net/xbiblio/csl'}
>>===== MODE =====>>
citation
<<===== MODE =====<<
>>===== RESULT =====>>
Ravemachine. Choreografie: Doris Uhlich, brut Wien, Premiere: 12.10.2016
Ravemachine. Choreografie: Doris Uhlich, brut Wien, Premiere: 12.10.2016
<<===== RESULT =====<<
@zepinglee
zepinglee / example-item.json
Created June 1, 2023 06:04
Example of Zotero's `country` field exported to CSL-JSON
[
{
"id": "koseki2005compiler",
"type": "patent",
"authority": "United States",
"call-number": "US09828402",
"language": "en",
"number": "US6944852B2",
"title": "Compiler",
"URL": "https://patents.google.com/patent/US6944852B2/en?oq=US6944852B2",
# MIT license
# Copy new terms of `locales-en-US.xml` to other locals.
# Step 1: Add new terms in `locales-en-US.xml`. Make sure the "short", "verb",
# "verb-short" forms of each new term are also included.
# Step 2: Run `python3 add-locale-terms.py`
import glob
>>===== MODE =====>>
citation
<<===== MODE =====<<
>>===== DESCRIPTION =====>>
The citperoc-js (73bc1b44) gives:
+ expected - actual
@zepinglee
zepinglee / sort_CitationByYearSuffix.txt
Created October 7, 2023 14:52
Sorting citation items by year-suffix
>>===== MODE =====>>
citation
<<===== MODE =====<<
>>===== RESULT =====>>
>>[0] (Nietzsche 1988a, 1988b)
<<===== RESULT =====<<
@zepinglee
zepinglee / sort-year-suffix.tex
Created October 7, 2023 15:04
APA: Sorting citation items by year-suffix
\documentclass{article}
\begin{filecontents}[force,noheader]{\jobname.bib}
@book{ITEM-1,
author = {Nietzsche, Friedrich},
title = {Title B of ITEM-1},
date = 1988,
}
@book{ITEM-2,
\documentclass{article}
\usepackage[style=turabian-author-date]{citation-style-language}
% \usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{nietzsche:ksa,nietzsche:ksa1}
\printbibliography
\end{document}