Last active
August 31, 2024 08:14
-
-
Save ryo-ARAKI/c4f55e2c4c57a5997700160cc6ea55df to your computer and use it in GitHub Desktop.
Unique commands and default setting for LaTeX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 雑誌名の短縮形リスト | |
\DeclareSourcemap{% | |
\maps[datatype=bibtex,overwrite=true]{ | |
\map{ | |
\step[ | |
fieldsource=journal, | |
match={Journal of Fluid Mechanics}, | |
replace={J. Fluid Mech.}]% | |
\step[ | |
fieldsource=journal, | |
match={Physical Review E}, | |
replace={Phys. Rev. E}]% | |
\step[ | |
fieldsource=journal, | |
match={Physical Review X}, | |
replace={Phys. Rev. X}]% | |
\step[ | |
fieldsource=journal, | |
match={Physical Review Letters}, | |
replace={Phys. Rev. Lett.}]% | |
\step[ | |
fieldsource=journal, | |
match={Physical Review Fluids}, | |
replace={Phys. Rev. Fluids}]% | |
\step[ | |
fieldsource=journal, | |
match={Physical Review Research}, | |
replace={Phys. Rev. Res.}]% | |
\step[ | |
fieldsource=journal, | |
match={Annual Review of Fluid Mechanics}, | |
replace={Annu. Rev. Fluid Mech.}]% | |
\step[ | |
fieldsource=journal, | |
match={Nature Communications}, | |
replace={Nat. Comm.}]% | |
\step[ | |
fieldsource=journal, | |
match={Fluid Dynamics Research}, | |
replace={Fluid Dyn. Res.}]% | |
\step[ | |
fieldsource=journal, | |
match={Journal of Computational Physics}, | |
replace={J. Comput. Phys.}]% | |
\step[ | |
fieldsource=journal, | |
match={Computer Physics Communications}, | |
replace={Comput. Phys. Commun.}]% | |
\step[ | |
fieldsource=journal, | |
match={Proceedings of the National Academy of Sciences}, | |
replace={Proc. Natl. Acad. Sci. USA}]% | |
\step[ | |
fieldsource=journal, | |
match={New Journal of Physics}, | |
replace={New J. Phys.}]% | |
\step[ | |
fieldsource=journal, | |
match={Theoretical and Applied Mechanics Letters}, | |
replace={Theor. App. Mech. Lett.}]% | |
\step[ | |
fieldsource=journal, | |
match={Physics of Fluids}, | |
replace={Phys. Fluids}]% | |
\step[ | |
fieldsource=journal, | |
match={Journal of Statistical Physics}, | |
replace={J. Stat. Phys.}]% | |
\step[ | |
fieldsource=journal, | |
match={Journal of Turbulence}, | |
replace={J. Turbul.}]% | |
\step[ | |
fieldsource=journal, | |
match={Physics Reports}, | |
replace={Phys. Rep.}]% | |
\step[ | |
fieldsource=journal, | |
match={European Physical Letters}, | |
replace={EPL}]% | |
\step[ | |
fieldsource=journal, | |
match={Journal of the Atmospheric Sciences}, | |
replace={J. Atmos. Sci.}]% | |
\step[ | |
fieldsource=journal, | |
match={Scientific Reports}, | |
replace={Sci. Rep.}]% | |
\step[ | |
fieldsource=journal, | |
match={Physica D: Nonlinear Phenomena}, | |
replace={Physica D}]% | |
\step[ | |
fieldsource=journal, | |
match={Doklady Akademii Nauk SSSR}, | |
replace={Dokl. Akad. Nauk SSSR}]% | |
\step[ | |
fieldsource=journal, | |
match={Journal of Physics: Conference Series}, | |
replace={ J. Phys. Conf. Ser.}]% | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% +++++++++++++++++++++++++++++++++++++++++++ | |
% 独自コマンドによるLaTeX設定の構築 | |
% LaTeX,英語 | |
% +++++++++++++++++++++++++++++++++++++++++++ | |
% | |
% =========================================== | |
% フォント設定 | |
% =========================================== | |
\usepackage{hyperref} % 図・表・参考文献へのリンク | |
\hypersetup{ | |
colorlinks=true, | |
linkcolor=magenta, | |
citecolor=blue, | |
urlcolor=cyan | |
} | |
\usepackage[utf8]{inputenc} % utf-8を使うためのパッケージ | |
\usepackage{indentfirst} | |
\usepackage{times} % Use the times font | |
% \usepackage{palatino} % Uncomment to use the Palatino font | |
\usepackage{url} | |
% | |
% =========================================== | |
% 図・表関係 | |
% =========================================== | |
\usepackage{here} | |
\usepackage{xcolor} % Specify colors by their 'svgnames', for a full list of all colors available see here: http://www.latextemplates.com/svgnames-colors | |
\usepackage{booktabs} % 表の横罫線 | |
\usepackage{lscape} % 表などを90度回転させる | |
\usepackage{longtable} % ページをまたぐ表の作成 | |
\usepackage[labelformat=simple]{subcaption} | |
\renewcommand\thesubfigure{~(\alph{subfigure})} % print like Fig.~1~(a) | |
\usepackage{tcolorbox} % 背景色ありの枠付きボックス | |
% | |
% =========================================== | |
% 数学記号 | |
% =========================================== | |
\usepackage{bm, amsfonts, amsmath, amsthm, amssymb, ascmac} % mathabx | |
\usepackage{siunitx} %SI単位系を上手くやってくれる:\SI{数値}{単位},\si{単位} | |
\usepackage{mathtools} | |
\usepackage{physics} | |
\usepackage{empheq} | |
% https://tex.stackexchange.com/a/147461 | |
\def\onedot{$\mathsurround0pt\ldotp$} | |
\def\cddot{% two dots stacked vertically | |
\mathbin{\vcenter{\baselineskip.67ex | |
\hbox{\onedot}\hbox{\onedot}}% | |
}}% | |
% mathematical environment | |
\usepackage{amsthm} | |
\theoremstyle{assumption} | |
\newtheorem*{assumption}{Assumption} | |
% | |
% =========================================== | |
% itemize/enumerateの行間調整 | |
% =========================================== | |
% | |
\let\oldenumerate\enumerate | |
\let\olditemize\itemize | |
\renewcommand{\itemize}{ | |
\olditemize | |
\setlength{\itemsep}{2pt} % 項目間 | |
\setlength{\parskip}{2pt} % 段落間 | |
\setlength{\parsep}{0pt} | |
} | |
\renewcommand{\enumerate}{ | |
\oldenumerate | |
\setlength{\itemsep}{2pt} % 項目間 | |
\setlength{\parskip}{2pt} % 段落間 | |
\setlength{\parsep}{0pt} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% +++++++++++++++++++++++++++++++++++++++++++ | |
% 独自コマンドによるLaTeX設定の構築 | |
% Beamer,英語 | |
% +++++++++++++++++++++++++++++++++++++++++++ | |
% | |
\usepackage{/home/ryo/.config/LaTeX/mystyle} | |
\usepackage{tikz} | |
\usetikzlibrary{positioning} | |
% | |
% =========================================== | |
% Beamerテーマの設定 | |
% =========================================== | |
\usetheme{boxes} | |
\usecolortheme{whale} | |
\usefonttheme{professionalfonts} | |
\usefonttheme[onlymath]{serif} | |
\setbeamertemplate{footline}[frame number] | |
\setbeamerfont{page number in head/foot}{family=\ttfamily,size=\large} | |
\setbeamertemplate{navigation symbols}{} | |
\usepackage{multicol} | |
\setlength{\columnsep}{3zh} | |
\setbeamercovered{transparent} % \pause や \onslide 環境など表示されるタイミング以外でも薄く表示する | |
% | |
% =========================================== | |
% itemize環境中で数式を使う際のスペーシングを修正 | |
% cf. https://tex.stackexchange.com/questions/439869/problems-with-spacing-beamer-itemize-and-equation | |
% =========================================== | |
\g@addto@macro\normalsize{ | |
\setlength\abovedisplayskip{5pt} | |
\setlength\belowdisplayskip{5pt} | |
\setlength\abovedisplayshortskip{5pt} | |
\setlength\belowdisplayshortskip{5pt} | |
} | |
% | |
% =========================================== | |
% フォント設定 | |
% =========================================== | |
\usepackage{textgreek} | |
% ソースコードの表示:\begin{frame}[fragile]オプションが必要 | |
\usepackage{listings} | |
\lstset{ | |
language={Fortran}, | |
basicstyle={\ttfamily}, | |
keywordstyle={\color{blue}}, | |
commentstyle={\color{green}}, | |
stringstyle=\color{red}, | |
tabsize=2, | |
breaklines=true, | |
} | |
% Re-define \emph by bold & italic | |
% https://tex.stackexchange.com/a/227644 | |
\let\emph\relax | |
\DeclareTextFontCommand{\emph}{\bfseries\em} | |
% | |
% =========================================== | |
% 強調構文などの設定 | |
% =========================================== | |
\newcommand{\stress}[1]{{\colorbox{Pink}{#1}}} % 強調箇所 | |
\setbeamercolor{advanced}{fg=black,bg=Wheat} % 発展した情報を扱うための薄ピンク背景,黒文字の色付きbox | |
\setbeamercolor{stress}{fg=black,bg=Pink} % 強調を表すためのピンク背景・黒文字の色付きbox | |
\setbeamercolor{stress2}{fg=black,bg=Gold} % 強調を表すための黄色背景・黒文字の色付きbox | |
% tikzを使った強調構文 | |
\newcommand{\highlight}[2][yellow]{\tikz[baseline=(x.base)]{\node[rectangle,rounded corners,fill=#1!30](x){#2};}} | |
\newcommand{\highlightcap}[3][yellow]{\tikz[baseline=(x.base)]{\node[rectangle,rounded corners,fill=#1!30](x){#2} node[below of=x, color=#1]{#3};}} | |
% itemize環境で赤いbulletを使う | |
\newenvironment{redenv}{\only{\setbeamercolor{local structure}{fg=red}}}{} | |
% hyperlinkに色をつけない | |
\hypersetup{colorlinks=false} | |
% | |
% =========================================== | |
% 補足ページに関する設定 | |
% =========================================== | |
\usepackage{cancel} | |
\newcommand{\backupbegin}{ | |
\newcounter{framenumberappendix} | |
\setcounter{framenumberappendix}{\value{framenumber}} | |
} | |
\newcommand{\backupend}{ | |
\addtocounter{framenumberappendix}{-\value{framenumber}} | |
\addtocounter{framenumber}{\value{framenumberappendix}} | |
} | |
% | |
% =========================================== | |
% 参考文献の書式設定 | |
% https://tex.stackexchange.com/questions/291296/biblatex-beamer-missing-citation-abbreviation-in-the-bibliography | |
% =========================================== | |
\renewcommand*{\labelalphaothers}{} | |
\DeclareLabelalphaTemplate{ | |
\labelelement{ | |
\field[final]{shorthand} | |
\field{labelname} | |
\field{label} | |
} | |
\labelelement{ | |
\literal{\addhighpenspace} | |
} | |
\labelelement{ | |
\field{year} | |
} | |
} | |
% | |
% Print 'number' field, not 'issue' | |
\renewbibmacro*{volume+number+eid}{% | |
\printfield{volume}% | |
\setunit*{\addnbspace}% | |
\printfield{number}% | |
\setunit{\addcomma\space}% | |
\printfield{eid}} | |
% | |
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}} % volume in bold font | |
\DeclareFieldFormat{note}{(#1)} % Add parentheses to note | |
% | |
% Drop quotation mark from title | |
% cf. https://tex.stackexchange.com/a/462137 | |
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1\isdot} | |
% | |
% Put parentheses around volume number of journal | |
% cf. https://tex.stackexchange.com/a/81573 | |
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}} % parentheses around number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% +++++++++++++++++++++++++++++++++++++++++++ | |
% 独自コマンドによるLaTeX設定の構築 | |
% Beamer,日本語 | |
% +++++++++++++++++++++++++++++++++++++++++++ | |
% | |
\usepackage{/home/ryo/.config/LaTeX/mystyle_beamer} | |
\usepackage{/home/ryo/.config/LaTeX/mystyle_jpn} | |
\renewcommand{\kanjifamilydefault}{\gtdefault}% 和文をゴシックに |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% +++++++++++++++++++++++++++++++++++++++++++ | |
% Bibliography setting equivalent to my PhD thesis | |
% +++++++++++++++++++++++++++++++++++++++++++ | |
% =========================================== | |
% Bibliography | |
% =========================================== | |
% Print 'number' field, not 'issue' | |
\renewbibmacro*{volume+number+eid}{% | |
\printfield{volume}% | |
\setunit*{\addnbspace}% | |
\printfield{number}% | |
\setunit{\addcomma\space}% | |
\printfield{eid}} | |
% | |
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}} % volume in bold font | |
\DeclareFieldFormat{note}{(#1)} % Add parentheses to note | |
% | |
% Drop quotation mark from title | |
% cf. https://tex.stackexchange.com/a/462137 | |
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1\isdot} | |
% | |
% Put parentheses around volume number of journal | |
% cf. https://tex.stackexchange.com/a/81573 | |
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}} % parentheses around number | |
% | |
% Update backref style | |
% cf. https://tex.stackexchange.com/a/36308 | |
\DefineBibliographyStrings{english}{ | |
backrefpage = {\lowercase{c}ited on page}, | |
backrefpages = {\lowercase{c}ited on pages}, | |
} | |
% | |
% Longer line for \bibnamedash | |
% cf. https://tex.stackexchange.com/a/239373 | |
\setlength\bibhang{2.4em}%% two dashes and space | |
\renewcommand*\bibnamedash{\textemdash\textemdash\space} | |
% | |
% List of uncited reference | |
% cf. https://tex.stackexchange.com/a/6977 | |
\DeclareBibliographyCategory{cited} | |
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% +++++++++++++++++++++++++++++++++++++++++++ | |
% 独自コマンドによるLaTeX設定の構築 | |
% LaTeX,日本語 | |
% +++++++++++++++++++++++++++++++++++++++++++ | |
% | |
\usepackage{/home/ryo/.config/LaTeX/mystyle} | |
\usepackage{otf} % otfフォント | |
\usepackage{pxjahyper} % しおりの文字化けを防止 | |
% | |
% =========================================== | |
% 図,表,目次の設定 | |
% =========================================== | |
\renewcommand{\figurename}{図} | |
\renewcommand{\tablename}{表} | |
\renewcommand{\contentsname}{目次} | |
% | |
% =========================================== | |
% biblatexのlangidによる日本語文献の識別子を定義 | |
% cf. biblatex で日本語文献をサポート https://gist.github.com/idiotWu/4879a88a3e34618cc8215a43ba2e9fbd | |
% =========================================== | |
\AtEveryBibitem{ | |
% langid={Japanese} で識別 | |
\iffieldequalstr{langid}{Japanese} { | |
% コンマで区切り | |
\DeclareDelimFormat{finalnamedelim}{% | |
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% | |
\addspace\multinamedelim | |
} | |
% 名前を「姓 名」の順に | |
\DeclareNameFormat{default}{% | |
\usebibmacro{name:delim}{\namepartfamily\namepartgiven}% | |
\usebibmacro{name:hook}{\namepartfamily\namepartgiven}% | |
\namepartfamily\bibnamedelimc\namepartgiven% | |
\usebibmacro{name:andothers} | |
} | |
% URLの参照日付を年/月/日で表示 | |
\DeclareFieldFormat{urldate}{% | |
(\thefield{urlyear}/\thefield{urlmonth}/\thefield{urlday}~に参照\isdot) | |
} | |
}{} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usetikzlibrary{math, calc} | |
\usetikzlibrary{shapes.arrows} | |
% | |
% =========================================== | |
% Define vortex: | |
% =========================================== | |
% \spiralclock[draw options](placement)(end angle:revolutions:final radius:rotation angle) | |
% for clockwise vortex. | |
% \spiralcounterclock | |
% for counter-clockwise vortex. | |
% | |
% https://tex.stackexchange.com/questions/29147/spiral-spring-in-tikz | |
\newcommand\spiralclock{} % Just for safety so \def will not overwrite something | |
\newcommand\spiralcounterclock{} | |
\def\spiralclock[#1](#2)(#3:#4:#5:#6){ | |
\pgfmathsetmacro{\domain}{pi*#3/180+#4*2*pi} | |
\draw [ | |
#1, | |
shift={(#2)}, | |
rotate=#6, | |
domain=0:\domain, | |
variable=\t, | |
smooth, | |
samples=int(\domain/0.08) | |
] plot ({\t r}: {#5*\t/\domain}) | |
} | |
\def\spiralcounterclock[#1](#2)(#3:#4:#5:#6){ | |
\pgfmathsetmacro{\domain}{pi*#3/180+#4*2*pi} | |
\draw [ | |
#1, | |
shift={(#2)}, | |
rotate=#6, | |
domain=0:\domain, | |
variable=\t, | |
smooth, | |
samples=int(\domain/0.08) | |
] plot ({-\t r}: {#5*\t/\domain}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment