Skip to content

Instantly share code, notes, and snippets.

@tueda
Last active March 21, 2021 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tueda/c3ddf856f647d136e9f4843848072e9a to your computer and use it in GitHub Desktop.
Save tueda/c3ddf856f647d136e9f4843848072e9a to your computer and use it in GitHub Desktop.
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[{Makefile,*.mk}]
indent_style = tab
[*.tex]
indent_size = 2
indent_style = space
# This file is provided under the MIT License:
#
# MIT License
#
# Copyright (c) 2018-2020 Takahiro Ueda
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# latest-raw-url: https://raw.githubusercontent.com/tueda/makefile4latex/master/.gitignore
# Based on https://raw.githubusercontent.com/github/gitignore/6935207fef87dd7f0995b0260cdcdd38cf81e986/TeX.gitignore
# (2020-05-19, CC0-1.0).
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
*.ps
# *.eps
*.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
*.ist
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
*.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
*Notes.bib
########
# axodraw2
*.ax1
*.ax2
# bib2gls
*.glstex
# sortref
*_ref.tex
# convbkmk intermediate files.
*-convbkmk.ps
# dviout caches.
*.bmc
*.pbm
# Bounding boxes for dvipdfm/dvipdfmx.
*.bb
*.xbb
# textlint
.textlintcache
node_modules
package-lock.json
yarn.lock
# arXiv tarballs.
*.tar.gz
# Temporary files.
*.tmp
*.tmp*.*
*_tmp.???
# Directories created by the Makefile for LaTeX.
.dep/
.diff/
# cache directories.
.cache
_cache
cache
% Copyright (c) 2019-2021 Takahiro Ueda
%
% This file may be distributed and/or modified under the conditions of
% the LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version of
% this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% The latest version can be found in the following repository:
%
% https://github.com/tueda/beamertheme-naive
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthemenaive}[2021/01/31 v0.1e naive beamer theme]
\mode<presentation>
\RequirePackage{anyfontsize}
\RequirePackage{appendixnumberbeamer}
\RequirePackage{bookmark}
\RequirePackage{etoolbox}
\RequirePackage{graphicx}
\RequirePackage{ifluatex}
\RequirePackage{ifpdf}
\RequirePackage{ifthen}
\RequirePackage{ifxetex}
\RequirePackage{tikz}
\RequirePackage{xcolor}
%{{{ Flags
% Flag for (u)p(La)TeX.
\newboolean{naive@ptex}%
\@ifundefined{dtou}{%
\setboolean{naive@ptex}{false}%
}{%
\setboolean{naive@ptex}{true}%
}%
% Flag for up(La)TeX.
\newboolean{naive@uptex}%
\@ifundefined{ucs}{%
\setboolean{naive@uptex}{false}%
}{%
\setboolean{naive@uptex}{true}%
}%
% Flag for dvipdfmx.
\newboolean{naive@dvipdfmx}
\setboolean{naive@dvipdfmx}{false}
% Flag for Japanese slides.
\newboolean{naive@japanese}
\setboolean{naive@japanese}{false}
\ifthenelse{\boolean{naive@ptex}}{%
\setboolean{naive@japanese}{true}%
}%
% Flag for checking environment variables.
\newboolean{naive@env}
\setboolean{naive@env}{false}
% Name of the color theme to be used.
\newcommand{\naive@colortheme}{none}
% Flag for the font theme (non-empty of empty).
\newcommand{\naive@font}{1}
%}}}
%{{{ Options
% Use dvipdfmx as the driver.
\DeclareOption{dvipdfmx}{%
\setboolean{naive@dvipdfmx}{true}%
}
% Use settings for Japanese documents.
\DeclareOption{japanese}{%
\setboolean{naive@japanese}{true}%
}
% Use environment variables as extra (dynamic) options.
\DeclareOption{env}{%
\setboolean{naive@env}{true}%
}
% Do not change the color theme.
\DeclareOption{nocolor}{%
\renewcommand{\naive@colortheme}{nocolor}%
}
% Use the "light" color theme.
\DeclareOption{light}{%
\renewcommand{\naive@colortheme}{light}%
}
% Use the "dark" color theme.
\DeclareOption{dark}{%
\renewcommand{\naive@colortheme}{dark}%
}
% Do not change the font theme.
\DeclareOption{nofont}{%
\let\naive@font\@empty
}
\ExecuteOptions{light}
\ProcessOptions\relax
%}}}
%{{{ Patches
\ifthenelse{\boolean{naive@env}}{%
\AtEndPreamble{%
% Handle the FRAME environment variable.
% If FRAME is not empty, then pass it to \includeonlyframes.
% Note that labels of frames are automatically generated in below.
\GetEnv{\GetEnv@FRAME}{FRAME}%
\ifx\GetEnv@FRAME\empty
\else
\expandafter\includeonlyframes\expandafter{\GetEnv@FRAME}%
\fi
}%
}{}%
% \naive@patchfail{command-name}
\newcommand{\naive@patchfail}[1]{%
\PackageError{beamerthemenaive}{Failed to patch \protect#1}{Sorry!}%
}
% Override \maketitle.
\renewcommand{\maketitle}{%
\ifbeamer@inframe
\titlepage
\else
\frame[plain,noframenumbering]{\titlepage}%
\fi
}
% Automatically put a "section page" for each section.
\AtBeginSection{%
\ifbeamer@inframe
\sectionpage
\else
\frame[plain,c,noframenumbering]{%
\sectionpage
}%
\fi
}
% Fix \appendix.
\renewcommand{\appendixname}{Backup}% removes a pdf warning
\renewcommand{\appendixtotalframenumber}{0}% ensures 0, not empty as in old versions
\newcommand{\footpagenumberingprefix}{}
\apptocmd{\appendix}{%
\renewcommand{\footpagenumberingprefix}{Appendix - }%
% Add a "section page" for the appendix.
\section{\appendixname}%
}{}{\naive@patchfail{\appendix}}%
\renewcommand\appendixorig{}% in appendixnumberbeamer
% Put an unique default label (the frame number) to each frame.
% In appendix, they are A1, A2 etc. Frames without numbering get some suffixes.
% See https://tex.stackexchange.com/a/316015
\newcounter{naive@noframenumbering}
\patchcmd{\beamer@@@@frame}{%
\setkeys{beamerframe}{#2}%
}{%
\setkeys{beamerframe}{#2}%
\edef\theframe{\number\numexpr\value{framenumber}+1}%
\ifnum\mainend>0% from appendixnumberbeamer
\edef\theframe{A\theframe}%
\fi
\ifbeamer@noframenumbering
\edef\thelabel{\theframe.\arabic{naive@noframenumbering}}%
\stepcounter{naive@noframenumbering}%
\else
\edef\thelabel{\theframe}%
\setcounter{naive@noframenumbering}{0}%
\fi
% \message{framelabel=(\thelabel)}% debug
\edef\@xargs{{beamerframe}{label=\thelabel}}%
\expandafter\setkeys\@xargs
}{}{\naive@patchfail{\beamer@@@@frame}}%
% Make PDF bookmarks.
% See https://tex.stackexchange.com/a/66520
\apptocmd{\titlepage}{%
\only<1>{\bookmark[page=\the\c@page,level=1]{\inserttitle}}%
}{}{\naive@patchfail{\titlepage}}%
\apptocmd{\beamer@@frametitle}{%
\if\relax\detokenize{#1}\relax
\else
\only<1>{\bookmark[page=\the\c@page,level=3]{#1}}%
\fi
}{}{\naive@patchfail{\beamer@@frametitle}}%
% "Rerun LaTeX" message when the number of slides is changed.
\AtEndDocument{%
\ifnum\value{framenumber}=\inserttotalframenumber
\else
\@latex@warning@no@line{Total frame number changed.%
\MessageBreak Rerun to get the number correct}%
\fi
}
% See https://github.com/gdevenyi/phd_thesis/blob/master/presentation/fixpauseincludegraphics.sty
\newcommand{\transparent@value}{100}
\newcommand{\oldincludegraphics}{}
\let\oldincludegraphics\includegraphics
\renewcommand*{\includegraphics}[2][]{%
\ifcsname tikz@library@external@loaded\endcsname
\tikzset{external/export next=false}%
\fi
\begin{tikzpicture}%
{\node[opacity=\transparent@value/100] {\oldincludegraphics[#1]{#2}};}%
\end{tikzpicture}%
}
% override of the original beamer@mixin transparent
\define@key{beamer@mixin}{transparent}[15]{%
\def\beamer@uncoverbeforeactions{\ignorespaces\opaquenessCustom{#1}}%
\def\beamer@uncoverafteractions{\ignorespaces\opaquenessCustom{#1}}%
}
% mostly a copy-and-paste of the original code from beamerbaseoverlay.sty
\newcommand{\opaquenessCustom}[1]{%
\only<1->{%
\beamer@actions{%
\gdef\transparent@value{#1}% here we change the custom transparency according to the pauses
\expandafter\xdef\csname beamer@oldcolorhook%
\the\beamer@coveringdepth\endcsname{\beamer@colorhook}%
\expandafter\xdef\csname beamer@oldpgfextension%
\the\beamer@coveringdepth\endcsname{\beamer@pgfextension}%
{\globalcolorstrue\colorlet{beamer@freeze\the\beamer@coveringdepth}{bg}}%
\xdef\beamer@colorhook{!#1!beamer@freeze%
\the\beamer@coveringdepth\beamer@colorhook}%
\gdef\beamer@pgfextension{!#1opaque}%
\color{.}%
}%
{%
\gdef\transparent@value{100}% here we initialize our custom transparency
\xdef\beamer@colorhook{\csname beamer@oldcolorhook%
\the\beamer@coveringdepth\endcsname}%
\xdef\beamer@pgfextension{\csname beamer@oldpgfextension%
\the\beamer@coveringdepth\endcsname}%
\color{.}%
}%
}%
}%
% For dvipdfmx.
\ifthenelse{\boolean{naive@dvipdfmx}}{%
\RequirePackage{bxdpx-beamer}%
% Fix href + includegraphics in dvipdfmx
% We need some bounding box: https://ja.stackoverflow.com/a/69667
% cf. https://tex.stackexchange.com/a/85103
\newcommand{\@naive@old@href}{}%
\let\@naive@old@href\href
\newcommand{\@naive@old@includegraphics}{}%
\let\@naive@old@includegraphics\includegraphics
\newcommand{\@naive@new@includegraphics}[2][]{%
\bxqbd@enghost{\@naive@old@includegraphics[#1]{#2}}%
}%
\renewcommand{\href}[2]{%
{%
\let\includegraphics\@naive@new@includegraphics
\@naive@old@href{#1}{#2}%
}%
}%
}{}
% For Japanese slides.
\ifthenelse{\boolean{naive@japanese}}{%
\ifthenelse{\boolean{luatex}}{%
% LuaLaTeX + LuaTeX-ja
\RequirePackage{luatexja}%
}{%
\ifthenelse{\boolean{xetex}}{%
% XeLaTeX + zxjatype
\RequirePackage{zxjatype}%
}{%
\ifthenelse{\boolean{pdf}}{%
\ifthenelse{\boolean{naive@ptex}}{%
}{%
% pdfLaTeX + bxcjkjatype
\RequirePackage[whole,autotilde]{bxcjkjatype}%
}%
}{%
\ifthenelse{\boolean{naive@ptex}}{%
\ifthenelse{\boolean{naive@dvipdfmx}}{%
% (u)pLaTeX + dvipdfmx
\RequirePackage{pxjahyper}%
}{%
}%
}{%
}%
}%
}%
}%
% Default date in Japanese.
\IfFileExists{bxwareki.sty}{%
\RequirePackage{bxwareki}%
\date{\warekisettoday\warekicustomdate{}}%
}{}%
}{}
%}}}
%{{{ New commands
% \GetEnv{ctl-seq}{env-var-name} gets an environment variable.
% https://tex.stackexchange.com/a/62032
\ifthenelse{\boolean{xetex}}{%
% NOTE: -shell-escape is necessary.
\RequirePackage{catchfile}
\newcommand\GetEnv[2]{%
\immediate\write18{kpsewhich --var-value #2 > \jobname.tmp}%
\CatchFileDef{\GetEnv@temp}{\jobname.tmp}{\endlinechar=-1}%
\if\relax\detokenize{#1}\relax\GetEnv@temp\else\let#1\@GetEnv@temp\fi}
}{\ifthenelse{\boolean{luatex}}{%
% Old LuaTeX may cause a problem due to \luaescapestring vs.
% \luatexluaescapestring.
\newcommand\GetEnv[2]{%
\edef\GetEnv@temp{\directlua{tex.sprint(
kpse.var_value("\luaescapestring{#2}") or "" ) }}%
\if\relax\detokenize{#1}\relax\GetEnv@temp\else\let#1\GetEnv@temp\fi}
}{
\RequirePackage{catchfile}
\newcommand{\GetEnv}[2]{%
\CatchFileEdef{\GetEnv@temp}{"|kpsewhich --var-value #2"}{\endlinechar=-1}%
\if\relax\detokenize{#1}\relax\GetEnv@temp\else\let#1\GetEnv@temp\fi}
}}
%}}}
%{{{ Color
% cf. https://material.io/tools/color
\definecolor{NaiveBlue} {HTML}{1976D2}% Blue 700
\definecolor{NaiveCyan} {HTML}{00BCD4}% Cyan 500
\definecolor{NaiveGreen} {HTML}{00695C}% Green 800
\definecolor{NaiveRed} {HTML}{FF5252}% Red A200
\definecolor{NaiveYellow}{HTML}{F9A825}% Yellow 800
\definecolor{NaiveLightBlue} {HTML}{E3F2FD}% Blue 50
\definecolor{NaiveLightLime} {HTML}{F9FBE7}% Lime 50
\definecolor{NaiveLightOrange}{HTML}{FFF3E0}% Orange 50
\definecolor{NaiveDarkBrown} {HTML}{3E2723}% Brown 900
\definecolor{NaiveDarkIndigo}{HTML}{1A237E}% Indigo 900
\definecolor{NaiveDarkTeal} {HTML}{004D40}% Teal 900
\def\naive@knownaccents{%
NaiveBlue,%
NaiveCyan,%
NaiveGreen,%
NaiveRed,%
NaiveYellow%
}
\def\@tempa{white}
\@for\@tempb:=\naive@knownaccents\do{%
\edef\@tempa{\@tempa,\@tempb,\@tempb!75!white}%
}
\let\naive@knownaccents\@tempa
% \ColorDistanceSq{<color1>}{<color2>}{<result-cmd>} gives the color distance
% between two colors.
\newcommand{\ColorDistanceSq}[3]{%
\extractcolorspec{#1}{\@tempa}%
\expandafter\convertcolorspec\@tempa{rgb}{\@tempa}%
\extractcolorspec{#2}{\@tempb}%
\expandafter\convertcolorspec\@tempb{rgb}{\@tempb}%
\edef\@tempa{\@tempa,\@tempb}%
\expandafter\@ColorDistanceSq\@tempa,{#3}%
}
\newcommand{\@ColorDistanceSq}{}
\def\@ColorDistanceSq#1,#2,#3,#4,#5,#6,#7{%
% I found this "approximation" in Wikipedia...
% 0.0 <= d^2 <= 9.0.
\pgfmathsetmacro{\@tempa}{(#1+#4)/2}%
\pgfmathsetmacro{#7}{(2+\@tempa)*(#1-#4)^2+4*(#2-#5)^2+(3-\@tempa)*(#3-#6)^2}%
}
% \FarthestColor{<candidate-list>}{<fg-list>}{<bg-list>}{<bg-factor>}{<result-cmd>}
% finds a color that are farthest from the given foreground and background
% colors. Background colors get a weight (0 < w <= 1) for the distance.
\newcommand{\FarthestColor}[5]{%
\let\@tempc\relax
\edef\@tempd{-1}%
\@for\@tempe:=#1\do{%
\ifx\@tempe\@empty
\else
\edef\@tempg{10}%
\@for\@tempf:=#2\do{%
\ifx\@tempf\@empty
\else
\ifdim\@tempg\p@>\@tempd\p@
\ColorDistanceSq{\@tempe}{\@tempf}{\@temph}%
\pgfmathsetmacro{\@tempg}{min(\@tempg,\@temph)}%
\fi
\fi
}%
\@for\@tempf:=#3\do{%
\ifx\@tempf\@empty
\else
\ifdim\@tempg\p@>\@tempd\p@
\ColorDistanceSq{\@tempe}{\@tempf}{\@temph}%
\pgfmathsetmacro{\@tempg}{min(\@tempg,#4*\@temph)}%
\fi
\fi
}%
\ifdim\@tempg\p@>\@tempd\p@
\let\@tempc\@tempe
\let\@tempd\@tempg
\fi
\fi
}%
\let#5\@tempc
}
\newcommand{\naive@bgfactor}{0.25}
\newcommand{\UpdateNormalColor}{%
% from beamerbasecolor.sty
\usebeamercolor*{alerted text}
\usebeamercolor*{example text}
\usebeamercolor*{structure}
\usebeamercolor{normal text}
\color{fg}
\def\normalcolor{\color{normal text.fg}}
}%
% \ChangeColorScheme{<options>} changes the color scheme for the color theme.
\pgfkeys{
/naive/color/scheme/.cd,
fg/.code={%
\edef\naive@colorscheme@fg{#1}%
},
bg/.code={%
\edef\naive@colorscheme@bg{#1}%
},
accent/.code={%
\edef\naive@colorscheme@accent{#1}%
},
structure/.code={%
\edef\naive@colorscheme@structure{#1}%
},
alert/.code={%
\edef\naive@colorscheme@alert{#1}%
},
example/.code={%
\edef\naive@colorscheme@example{#1}%
},
shading/.is choice,
shading/none/.code={%
\edef\naive@colorscheme@shading{}%
},
shading/vertical/.code={%
\edef\naive@colorscheme@shading{vertical}%
},
top/.code={%
\edef\naive@colorscheme@top{#1}%
},
bottom/.code={%
\edef\naive@colorscheme@bottom{#1}%
},
middle/.code={%
\edef\naive@colorscheme@middle{#1}%
},
midpoint/.code={%
\edef\naive@colorscheme@midpoint{#1}%
},
}
\newcommand{\ChangeColorScheme}[1]{%
\pgfkeys{
/naive/color/scheme/.cd,
fg=black,
bg=white,
accent=,
structure=,
alert=,
example=,
shading=none,
top=,
bottom=,
middle=,
midpoint=0.5,
#1
}%
% If the accent color is not specified, then use the foreground color for it.
\ifx\naive@colorscheme@accent\@empty
\let\naive@colorscheme@accent\naive@colorscheme@fg
\fi
% Foreground and background.
\colorlet{NaiveForeground}{\naive@colorscheme@fg}%
\colorlet{NaiveBackground}{\naive@colorscheme@bg}%
\colorlet{NaiveAccent}{\naive@colorscheme@accent}%
\edef\naive@colorscheme@fglist{NaiveForeground,NaiveAccent}%
\ifx\naive@colorscheme@shading\@empty
\edef\naive@colorscheme@bglist{NaiveBackground}%
\ColorDistanceSq{NaiveBackground}{white}{\@tempa}%
\ifdim\@tempa\p@>\z@%
\setbeamercolor{normal text}{fg=NaiveForeground,bg=NaiveBackground}
\else
\setbeamercolor{normal text}{fg=NaiveForeground,bg=}
\fi
\setbeamertemplate{background canvas}[default]
\else
\edef\naive@colorscheme@bglist{}%
\setbeamercolor{normal text}{fg=NaiveForeground,bg=}
\ifthenelse{\equal{\naive@colorscheme@shading}{vertical}}{%
\ifx\naive@colorscheme@top\@empty
\let\naive@colorscheme@top\naive@colorscheme@bg
\fi
\ifx\naive@colorscheme@bottom\@empty
\let\naive@colorscheme@bottom\naive@colorscheme@bg
\fi
\ifx\naive@colorscheme@middle\@empty
\edef\naive@colorscheme@bglist{\naive@colorscheme@bglist,%
\naive@colorscheme@top,%
\naive@colorscheme@top!50!\naive@colorscheme@bottom,%
\naive@colorscheme@bottom}%
\setbeamertemplate{background canvas}[vertical shading][
top=\naive@colorscheme@top,
bottom=\naive@colorscheme@bottom,
midpoint=\naive@colorscheme@midpoint,
]%
\else
\edef\naive@colorscheme@bglist{\naive@colorscheme@bglist,%
\naive@colorscheme@top,%
\naive@colorscheme@top!50!\naive@colorscheme@middle,%
\naive@colorscheme@middle,%
\naive@colorscheme@middle!50!\naive@colorscheme@bottom,%
\naive@colorscheme@bottom}%
\setbeamertemplate{background canvas}[vertical shading][
top=\naive@colorscheme@top,
middle=\naive@colorscheme@middle,
bottom=\naive@colorscheme@bottom,
midpoint=\naive@colorscheme@midpoint,
]%
\fi
}{}%
\fi
\ifx\naive@colorscheme@structure\@empty
\else
\edef\naive@colorscheme@fglist{\naive@colorscheme@fglist,\naive@colorscheme@structure}%
\fi
\ifx\naive@colorscheme@alert\@empty
\else
\edef\naive@colorscheme@fglist{\naive@colorscheme@fglist,\naive@colorscheme@alert}%
\fi
\ifx\naive@colorscheme@example\@empty
\else
\edef\naive@colorscheme@fglist{\naive@colorscheme@fglist,\naive@colorscheme@example}%
\fi
% If the structure color is not specified, then use the accent color for it.
\ifx\naive@colorscheme@structure\@empty
\colorlet{NaiveStructure}{NaiveAccent}%
\else
\colorlet{NaiveStructure}{\naive@colorscheme@structure}%
\fi
% Choose the title color. Preference is given for brighter colors (not black).
\FarthestColor{NaiveAccent,NaiveStructure,NaiveForeground}{\naive@colorscheme@bglist}{black}{\naive@bgfactor}{\@tempa}%
\colorlet{NaiveTitle}{\@tempa}%
% If the alert color is not specified, then choose a color from our list.
% Preference is given for brighter colors (not black) and reddish colors
% (not lime).
\ifx\naive@colorscheme@alert\@empty
\FarthestColor{\naive@knownaccents}{\naive@colorscheme@fglist}{\naive@colorscheme@bglist}{\naive@bgfactor}{\naive@colora}%
\FarthestColor{\naive@knownaccents}{\naive@colorscheme@fglist,\naive@colora}{\naive@colorscheme@bglist}{\naive@bgfactor}{\naive@colorb}%
\FarthestColor{\naive@colora,\naive@colorb}{lime}{black}{\naive@bgfactor}{\@tempa}%
\colorlet{NaiveAlert}{\@tempa}%
\edef\naive@colorscheme@fglist{\naive@colorscheme@fglist,\@tempa}%
\else
\colorlet{NaiveAlert}{\naive@colorscheme@alert}%
\fi
% If the example color is not specified, then choose a color from our list.
\ifx\naive@colorscheme@example\@empty
\FarthestColor{\naive@knownaccents}{\naive@colorscheme@fglist}{\naive@colorscheme@bglist}{\naive@bgfactor}{\@tempa}%
\colorlet{NaiveExample}{\@tempa}%
\edef\naive@colorscheme@fglist{\naive@colorscheme@fglist,\@tempa}%
\else
\colorlet{NaiveExample}{\naive@colorscheme@example}%
\fi
\setbeamercolor{structure}{fg=NaiveStructure}%
\setbeamercolor{alerted text}{fg=NaiveAlert}%
\setbeamercolor{example text}{fg=NaiveExample}%
\setbeamercolor{titlelike}{parent=structure,fg=NaiveTitle}%
\setbeamercolor{item}{parent=local structure,fg=NaiveTitle}%
% Need to update the current color when not in the preamble.
\ifx\@onlypreamble\@notprerr
\UpdateNormalColor
\fi
}
% \ChangeColorTheme{<name>} changes the coloring to the given preset.
\newcommand{\ChangeColorTheme}[1]{%
\@nameuse{naive@colortheme@init@#1}%
}
\newcommand{\naive@colortheme@init@nocolor}{%
}
\newcommand{\naive@colortheme@init@light}{%
\ChangeColorScheme{%
fg=NaiveDarkTeal!75!black,
bg=white,
accent=NaiveBlue,
alert=NaiveRed,
}%
}
\newcommand{\naive@colortheme@init@dark}{%
\colorlet{shading top}{black}%
\definecolor{shading middle}{rgb}{0.14,0.14,0.20}%
\definecolor{shading bottom}{rgb}{0.39,0.39,0.45}%
\ChangeColorScheme{%
fg=white,
accent=NaiveBlue!75!white,
alert=NaiveRed!75!white,
shading=vertical,
top=shading top,
bottom=shading bottom,
middle=shading middle,
}%
}
\ChangeColorTheme{\naive@colortheme}
%}}}
%{{{ Font
\ifx\naive@font\@empty
\else
\RequirePackage[T1]{fontenc}
%\RequirePackage[sfdefault]{FiraSans}
\RequirePackage[sfdefault]{roboto}
\beamer@suppressreplacementstrue
\RequirePackage{fouriernc}
\newcommand{\titlefont}{\robotocondensed}
\ifthenelse{\boolean{naive@japanese}}{%
\ifthenelse{\boolean{luatex}}{%
% LuaLaTeX
\RequirePackage[ipaex]{luatexja-preset}%
\renewcommand{\kanjifamilydefault}{\gtdefault}%
\renewcommand{\titlefont}{\robotocondensed\gtfamily}%
}{%
\ifthenelse{\boolean{xetex}}{%
% XeLaTeX
\RequirePackage[ipaex]{zxjafont}%
}{%
\ifthenelse{\boolean{naive@ptex}}{%
\ifthenelse{\boolean{naive@uptex}}{%
}{%
% pLaTeX
\usepackage{minijs}%
}%
% (u)pLaTeX
\renewcommand{\kanjifamilydefault}{\gtdefault}%
\renewcommand{\titlefont}{\robotocondensed\gtfamily}%
}{%
}%
}%
}%
}{}
\setbeamerfont{title}{family=\titlefont,series=\bfseries,size=\LARGE}
\setbeamerfont{date}{size=\scriptsize}
\setbeamerfont{frametitle}{family=\titlefont,series=\bfseries,size=\Large}
\fi
%}}}
%{{{ Outer
\setbeamertemplate{frametitle}[default][center]
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{%
\hfill
\footpagenumberingprefix\insertframenumber/\inserttotalframenumber
\hspace{7pt}%
\vspace{7pt}%
}
% Space between the title and text.
\addtobeamertemplate{frametitle}{}{\vspace*{1ex plus 1ex minus 0.5ex}}
%}}}
%{{{ Inner
% Space between paragraphs.
\setlength{\parskip}{3ex plus 2ex minus 2ex}% default: 0pt
% Use the default \parskip in the title page.
\pretocmd{\titlepage}{%
\setlength{\parskip}{0pt}%
}{}{\naive@patchfail{\titlepage}}%
% Space between items.
\apptocmd{\@listi}{%
\setlength{\itemsep}{\parskip}%
}{}{\naive@patchfail{\@listi}}%
\apptocmd{\@listii}{%
\setlength{\topsep}{2ex plus 0.5ex minus 0.5ex}%
\setlength{\itemsep}{2ex plus 1ex minus 1ex}%
}{}{\naive@patchfail{\@listii}}%
\let\@listI\@listi
% Space before/after verbatim.
\preto{\@verbatim}{%
\setlength{\partopsep}{\topsep}%
\setlength{\topsep}{-0.5ex plus 0.5ex minus 0ex}%
}
% Bigger bullet size for itemize.
\newcommand{\mybullet}{\LARGE\raise-0.3ex\hbox{\textbullet}}
\defbeamertemplate{itemize item}{mybullet}{\mybullet}
\setbeamertemplate{itemize item}[mybullet]
% "section page" template.
\defbeamertemplate{section page}{naive}[1][]{%
\begingroup
\centering
\begin{beamercolorbox}[sep=12pt,center,#1]{section title}%
\usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}%
\endgroup
}
\setbeamertemplate{section page}[naive]
%}}}
\mode<all>
% latest-raw-url: https://raw.githubusercontent.com/tueda/beamertheme-naive/master/beamerthemenaive.sty
MAKEFILE4LATEX_REVISION = v0.5.0
TOOLCHAIN = uplatex_dvipdfmx
BUILDDIR = .build
LATEX_OPT += -file-line-error
\documentclass[dvipdfmx,12pt]{beamer}
\usetheme[japanese,dark]{naive}
\title{マクローリン展開}
\date{}
\usepackage[haranoaji]{pxchfon}
\usepackage{tikz}
\usepackage{hyperref}
\usepackage{pgfplots}
\setbeamercovered{transparent=10}
\begin{document}
\begin{frame}[plain,noframenumbering]{}\titlepage
\end{frame}
\begin{frame}{マクローリン展開の定義}
\href{https://ja.wikipedia.org/wiki/\%E3\%83\%86\%E3\%82\%A4\%E3\%83\%A9\%E3\%83\%BC\%E5\%B1\%95\%E9\%96\%8B}{\underline{テイラー展開}}に
おいて$0$近辺で展開したものを特に \\ マクローリン展開と呼ぶ
\begin{equation*}
f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!} x^n
\end{equation*}
右辺を有限個の項の和として打ち切ることで \\
$f(x)$の近似値が得られる
\end{frame}
\begin{frame}{例1: \texorpdfstring{$\sin(x)$}{sin(x)}}
$\displaystyle
\sin(x)
\simeq
x
\uncover<2->{- \frac{1}{6} x^3}
\uncover<3->{+ \frac{1}{120} x^5}
\uncover<4->{- \frac{1}{5040} x^7}
\uncover<5->{+ \frac{1}{362880} x^9}
\uncover<6->{- \frac{1}{39916800} x^{11}}
$
\hspace{3em}
\begin{tikzpicture}
\begin{axis}[samples=500,domain=-4:4,restrict y to domain=-3:3,ymin=-3,ymax=3]
\addplot[red] {sin(deg(x))};
\only<1>{\addplot[] {x};}
\only<2>{\addplot[] {x-x^3/6};}
\only<3>{\addplot[] {x-x^3/6+x^5/120};}
\only<4>{\addplot[] {x-x^3/6+x^5/120-x^7/5040};}
\only<5>{\addplot[] {x-x^3/6+x^5/120-x^7/5040+x^9/362880};}
\only<6>{\addplot[] {x-x^3/6+x^5/120-x^7/5040+x^9/362880-x^11/39916800};}
\end{axis}
\end{tikzpicture}
\end{frame}
\begin{frame}{例2: \texorpdfstring{$\cos(x)$}{cos(x)}}
$\displaystyle
\cos(x)
\simeq
1
\uncover<2->{- \frac{1}{2} x^2}
\uncover<3->{+ \frac{1}{24} x^4}
\uncover<4->{- \frac{1}{720} x^6}
\uncover<5->{+ \frac{1}{40320} x^8}
\uncover<6->{- \frac{1}{3628800} x^{10}}
$
\hspace{3em}
\begin{tikzpicture}
\begin{axis}[samples=500,domain=-4:4,restrict y to domain=-3:3,ymin=-3,ymax=3]
\addplot[red] {cos(deg(x))};
\only<1>{\addplot[] {1};}
\only<2>{\addplot[] {1-x^2/2};}
\only<3>{\addplot[] {1-x^2/2+x^4/24};}
\only<4>{\addplot[] {1-x^2/2+x^4/24-x^6/720};}
\only<5>{\addplot[] {1-x^2/2+x^4/24-x^6/720+x^8/40320};}
\only<6>{\addplot[] {1-x^2/2+x^4/24-x^6/720+x^8/40320-x^10/3628800};}
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}
# @file Makefile (get/Makefile)
#
# Makefile for typesetting LaTeX documents. Requires GNU Make 3.81 on Linux.
# See "make help". Actually, this file downloads the main Makefile into the
# cache and then includes it.
#
# This file is provided under the MIT License:
#
# MIT License
#
# Copyright (c) 2020 Takahiro Ueda
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# $(call _read_config,VARIABLE) reads the specified variable from the user
# configuration. The variable should be defined in the following places
# (in descending precedence):
# (1) command line (e.g., make XX=YY),
# (2) configuration files:
# (a) latex.mk
# (b) .latex.mk
# (c) $(REAL_MAKEFILEDIR)/latex.mk
# (d) $(REAL_MAKEFILEDIR)/.latex.mk
# (e) ~/latex.mk
# (f) ~/.latex.mk
# where $(REAL_MAKEFILEDIR) is the directory that containing the "realpath"
# of the current Makefile (which may be different from the current
# directory).
# (3) environment variable.
#
# First, this macro checks if the variable is already defined by "command line".
# If not, then the macro tries to extract lines that matches with "$1 = ..." in
# configuration files and then evaluate the last one. The extraction should work
# unless the user writes tricky stuff (for example, continuation lines).
_read_config = \
$(eval $(strip \
$(if $(findstring command,$(origin $1)),, \
$(if $(_conf_file_list), \
$(shell grep '^ *$1 *=' $(_conf_file_list) \
| sed 's/^.*://' | tail -n 1) \
) \
) \
))
_real_makefile_dir := \
$(dir $(realpath $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))))
_conf_file_list := \
$(wildcard \
~/.latex.mk ~/latex.mk \
$(_real_makefile_dir)/.latex.mk $(_real_makefile_dir)/latex.mk \
.latex.mk latex.mk)
# The MAKEFILE4LATEX_REVISION variable controls the revision of Makefile for
# LaTeX to be downloaded.
$(call _read_config,MAKEFILE4LATEX_REVISION)
# The default value.
ifeq ($(MAKEFILE4LATEX_REVISION),)
override MAKEFILE4LATEX_REVISION = master
endif
# The MAKEFILE4LATEX_CACHE variable controls the cache location.
$(call _read_config,MAKEFILE4LATEX_CACHE)
# The default value depends on the OS.
ifeq ($(MAKEFILE4LATEX_CACHE),)
_uname_s := $(shell uname -s)
ifeq ($(_uname_s),Darwin)
override MAKEFILE4LATEX_CACHE = $(HOME)/Library/Caches/makefile4latex
else
override MAKEFILE4LATEX_CACHE = $(HOME)/.cache/makefile4latex
endif
endif
# Makefile to be included.
_Makefile_URL := https://raw.githubusercontent.com/tueda/makefile4latex/$(MAKEFILE4LATEX_REVISION)/Makefile
# The file path for the downloaded Makefile.
_cache_dir = $(MAKEFILE4LATEX_CACHE)/$(MAKEFILE4LATEX_REVISION)
_cached_Makefile := $(_cache_dir)/Makefile
include $(_cached_Makefile)
$(_cached_Makefile):
@mkdir -p "$(_cache_dir)"
@if command -v wget >/dev/null; then \
wget -O "$(_cached_Makefile).$$PPID.tmp" "$(_Makefile_URL)" \
&& mv "$(_cached_Makefile).$$PPID.tmp" "$(_cached_Makefile)"; \
elif command -v curl >/dev/null; then \
curl -L -o "$(_cached_Makefile).$$PPID.tmp" "$(_Makefile_URL)" \
&& mv "$(_cached_Makefile).$$PPID.tmp" "$(_cached_Makefile)"; \
else \
echo 'error: wget or curl required to download makefile4latex' >&2; \
exit 1; \
fi
_show_cache_info:
@echo "MAKEFILE4LATEX_REVISION = $(MAKEFILE4LATEX_REVISION)"
@echo "MAKEFILE4LATEX_CACHE = $(MAKEFILE4LATEX_CACHE)"
@echo " downloaded from : $(_Makefile_URL)"
@echo " cached to : $(_cached_Makefile)"
# latest-raw-url: https://raw.githubusercontent.com/tueda/makefile4latex/master/get/Makefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment