Settings

LaTeX preamble for Thesis/Dissertation

\usepackage{docmute} % To skip preambles of subfiles. 

\newif\ifMain

\Mainfalse

\newif\ifBookbinding

\Bookbindingfalse

\usepackage[utf8]{inputenc}

\usepackage[T1]{fontenc}

\usepackage{microtype}

\usepackage[a-2b,mathxmp]{pdfx}

% \usepackage[usenames]{xcolor} // xcolor is included in the pdfx package

% \usepackage{hyperref}         // hyperref is included in the pdfx package

\ifBookbinding

    \hypersetup{ % for bookbinding

        unicode,

        colorlinks=true,

        citecolor=black,

        linkcolor=black,

        urlcolor=black,

        bookmarksnumbered=true,

        bookmarkstype=toc

    }

\else

    \hypersetup{ % for pdf

        unicode,

        colorlinks=true,

        citecolor=blue,

        linkcolor=blue,

        urlcolor=blue,

        bookmarksnumbered=true,

        bookmarkstype=toc

    }

\fi

\usepackage[backend=biber, style=phys, biblabel=brackets, sorting=none]{biblatex}

\addbibresource{references.bib}


\usepackage{graphicx, tikz} % for figures, no options when submitting to arXiv

\usetikzlibrary{calc}

\usepackage[notrig]{physics}

\usepackage[version=4]{mhchem} % for chemical reactions

\usepackage{amsmath, amssymb} % for equations

\usepackage{mathtools} %for \coloneqq

\usepackage{faktor} % for quotient sets \faktor

\usepackage{siunitx} % for symbols for SI units.

\usepackage{csquotes} % for quotations such as \enquote


%%%%%%%%%%%%%%%%%%%% For Theorem environments %%%%%%%%%%%%%%%%%%%%

\usepackage{amsthm} % for theorem environments

\usepackage[framemethod=TikZ]{mdframed} % for framed environments

\renewcommand{\qed}{$\hfill\blacksquare$}

\usetikzlibrary{shadows,shadings}

\ifBookbinding

    \mdfdefinestyle{theoremstyle}{ % for bookbinding

        linewidth = 0.5pt, roundcorner=5pt,%

        frametitlerule =true, %

        frametitlebackgroundcolor=lightgray!40,

        backgroundcolor=lightgray!10,

        shadow=true,

    }

\else

    \mdfdefinestyle{theoremstyle}{ % for pdf

        linewidth = 0.5pt, roundcorner=5pt,%

        frametitlerule =true, %

        frametitlebackgroundcolor=blue!10,

        backgroundcolor=lightgray!20,

        shadow=true,

    } 

\fi

\mdtheorem[style=theoremstyle]{principle}{}

\mdtheorem[style=theoremstyle]{assumption}{Assumption}

\mdtheorem[style=theoremstyle]{definition}[theorem]{Definition}[chapter]

\mdtheorem[style=theoremstyle]{theorem}{Theorem}[chapter]

\mdtheorem[style=theoremstyle]{lemma}[theorem]{Lemma}[chapter]

\mdtheorem[style=theoremstyle]{proposition}[theorem]{Proposition}[chapter]

\mdtheorem[style=theoremstyle]{corollary}{Corollary}[chapter]

\surroundwithmdframed[

    topline=false,

    rightline=false,

    bottomline=false,

    linewidth=5pt,linecolor=lightgray!50,

    leftmargin=0,

    skipabove=\medskipamount,

    skipbelow=\medskipamount

]{proof}

%%%%%%%%%%%%%%%%%%%% (END)For Theorem environments %%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%% Document styles %%%%%%%%%%%%%%%%%%%%

\usepackage{newtxtext,newtxmath} % This needs to be placed after AMS packages.

\setkomafont{disposition}{\bfseries}

\setkomafont{pagehead}{\rmfamily}

\setkomafont{pagenumber}{\bfseries}

\AfterTOCHead{\pagestyle{plain}}

\AfterStartingTOC{\clearpage}

\renewcommand*{\chaptermarkformat}{\bfseries\chapapp~\thechapter\ \enskip\normalfont}

\usepackage[nodisplayskipstretch]{setspace}

\setstretch{1.15}

%%%%% Headers and footers

\usepackage[automark]{scrlayer-scrpage}

\newpairofpagestyles{scrheadingsFM}{}

\pagestyle{scrheadingsFM}

\cfoot*{\pagemark}

\KOMAoptions{headwidth=\textwidth+2cm:-1cm}

\KOMAoptions{footwidth=\textwidth+2cm:-1cm}

\pagestyle{scrheadings}

\ihead{}

\ohead*{\pagemark}

\chead{\headmark}

\cfoot*{}

\ofoot*{}

\addtolength{\topmargin}{-10pt}

\addtolength{\textheight}{10pt}

\addtolength{\textheight}{\footskip}

\setlength{\footskip}{\headsep}

%%%%% (END) Headers and footers

%%%%%%%%%%%%%%%%%%%% (END) Document styles %%%%%%%%%%%%%%%%%%%%


\graphicspath{{./Figure/}}


%%%%%%%%%%%%%%%%%%%% For improvement %%%%%%%%%%%%%%%%%%%%

% \setlength{\marginparwidth}{2cm}

% \usepackage[colorinlistoftodos]{todonotes}

% \usepackage{ulem}

% \newcommand{\fix}[2]{\sout{#1} \textcolor{blue}{#2}}

% \newcommand{\red}[1]{\textcolor{red}{#1}}

% \newcommand{\blue}[1]{\textcolor{blue}{#1}}

%%%%%%%%%%%%%%%%%%%% (END)For improvement %%%%%%%%%%%%%%%%%%%%

Zsh

# /etc/zshrc

#

# /etc/zshrc is sourced in interactive shells.  It

# should contain commands to set up aliases, functions,

# options, key bindings, etc.

#


## shell functions

#setenv() { export $1=$2 }  # csh compatibility


# Set prompts

# PROMPT='[%n@%m]%~%# '    # default prompt

#RPROMPT=' %~'     # prompt for right side of screen


# bindkey -v             # vi key bindings

# bindkey -e             # emacs key bindings

bindkey ' ' magic-space  # also do history expansion on space


# Provide pathmunge for /etc/profile.d scripts

pathmunge()

{

   if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)" ; then

       if [ "$2" = "after" ] ; then

           PATH=$PATH:$1

       else

           PATH=$1:$PATH

       fi

   fi

}


_src_etc_profile_d()

{

   #  Make the *.sh things happier, and have possible ~/.zshenv options like

   # NOMATCH ignored.

   emulate -L ksh



   # from bashrc, with zsh fixes

   if [[ ! -o login ]]; then # We're not a login shell

       for i in /etc/profile.d/*.sh; do

       if [ -r "$i" ]; then

           . $i

       fi

       done

       unset i

   fi

}

_src_etc_profile_d


unset -f pathmunge _src_etc_profile_d


########## Custom settings ##########

#################### git ####################

autoload -Uz vcs_info

zstyle ':vcs_info:git:*' check-for-changes true

zstyle ':vcs_info:git:*' stagedstr "%F{cyan}"

zstyle ':vcs_info:git:*' unstagedstr "%F{magenta}"

zstyle ':vcs_info:git:*' formats '%u%c(%r)-[%b]%f' '%c%u %m'

zstyle ':vcs_info:git:*' actionformats '%u%c(%r)-[%b|%a]%f' '%c%u %m'


################### prompts ####################

setopt prompt_subst

Date=$(date "+%Y/%m/%d")

precmd () {

   PROMPT="%(?.%F{cyan}.%F{red})$Date %* %d%f"

   PROMPT+="

%(?..%F{red})%n@%m %(?..(%?%)%f)%# "

}

precmd_vcs_info() { vcs_info }

precmd_functions+=( precmd_vcs_info )

RPROMPT=\$vcs_info_msg_0_


#################### auto-completion ####################

autoload -Uz compinit && compinit

zstyle ':completion:*' menu select


#################### alias ####################

alias ls='ls --color=auto'

alias grep='grep --color=auto'

alias crontab='crontab -i'


#################### history ####################

export HISTFILE=${HOME}/.zhistory

export HISTSIZE=1000

export SAVEHIST=100000

export IGNOREEOF=1000


setopt EXTENDED_HISTORY

setopt hist_ignore_dups

setopt hist_ignore_all_dups

setopt hist_save_no_dups

setopt hist_ignore_space

setopt hist_verify

setopt hist_reduce_blanks

setopt hist_expand

setopt inc_append_history


autoload history-search-end

zle -N history-beginning-search-backward-end history-search-end

zle -N history-beginning-search-forward-end history-search-end

bindkey "^R" history-incremental-search-backward

bindkey "^S" history-incremental-search-forward

bindkey "^p" history-beginning-search-backward-end

bindkey "^n" history-beginning-search-forward-end

bindkey "^u" backward-kill-line

bindkey "^w" kill-region

Vim

" # /etc/vimrc

if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"

   set fileencodings=ucs-bom,utf-8,latin1

endif


set nocompatible " Use Vim defaults (much better!)

set bs=indent,eol,start " allow backspacing over everything in insert mode

"set ai " always set autoindenting on

"set backup " keep a backup file

set viminfo='20,\"50 " read/write a .viminfo file, don't store more

" than 50 lines of registers

set history=50 " keep 50 lines of command line history

set ruler " show the cursor position all the time


" Only do this part when compiled with support for autocommands

if has("autocmd")

  augroup redhat

  autocmd!

  " In text files, always limit the width of text to 78 characters

  " autocmd BufRead *.txt set tw=78

  " When editing a file, always jump to the last cursor position

  autocmd BufReadPost *

  \ if line("'\"") > 0 && line ("'\"") <= line("$") |

  \   exe "normal! g'\"" |

  \ endif

  " don't write swapfile on most commonly used directories for NFS mounts or USB sticks

  autocmd BufNewFile,BufReadPre /media/*,/run/media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp

  " start with spec file template

  autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec

  augroup END

endif


if has("cscope") && filereadable("/usr/bin/cscope")

   set csprg=/usr/bin/cscope

   set csto=0

   set cst

   set nocsverb

   " add any database in current directory

   if filereadable("cscope.out")

      cs add $PWD/cscope.out

   " else add database pointed to by environment

   elseif $CSCOPE_DB != ""

      cs add $CSCOPE_DB

   endif

   set csverb

endif


" Switch syntax highlighting on, when the terminal has colors

" Also switch on highlighting the last used search pattern.

if &t_Co > 2 || has("gui_running")

  syntax on

  set hlsearch

endif


filetype plugin on


if &term=="xterm"

     set t_Co=8

     set t_Sb=[4%dm

     set t_Sf=[3%dm

endif


" Don't wake up system with blinking cursor:

" http://www.linuxpowertop.org/known.php

let &guicursor = &guicursor . ",a:blinkon0"


" ########## Custom settings ##########

set encoding=utf-8

set showcmd        " Show (partial) command in status line.

set showmatch      " Show matching brackets.

set autowrite      " Automatically save before commands like :next and :make

set mouse=a        " Enable mouse usage (all modes)

set number

set title

set tabstop=4

set shiftwidth=4

set autoindent

set smartindent

set list

set listchars=tab:»-,trail:-,eol:¬,extends:»,precedes:«,nbsp:%


let _curfile=expand("%:r")