Initial commit
This commit is contained in:
commit
618f6b678a
85
Jauslin_IAS_2017.tex
Normal file
85
Jauslin_IAS_2017.tex
Normal file
@ -0,0 +1,85 @@
|
||||
\documentclass[no_section_in_all]{ian}
|
||||
|
||||
\usepackage{graphicx}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\pagestyle{plain}
|
||||
\hfil{\bf\LARGE
|
||||
Liquid crystals and the Heilmann-Lieb conjecture
|
||||
}
|
||||
\vskip40pt
|
||||
|
||||
\hfil{\bf\large Ian Jauslin}\par
|
||||
\hfil{\it School of Mathematics, Institute for Advanced Study}\par
|
||||
\hfil{\tt\color{blue}\href{mailto:jauslin@ias.edu}{jauslin@ias.edu}}\par
|
||||
\vskip40pt
|
||||
|
||||
\indent Liquid crystals, discovered serendipitously by Friedrich Reinitzer in the late XIX\textsuperscript{th} century, have come to play an important role in the world of consumer electronics, specifically in the production of ever larger, thinner and energy efficient displays. Starting with the small, black and white, monochrome displays found in many digital watches and pocket calculators, all the way to the large, colorful screens in computer monitors, flat screen TVs and smartphones, liquid crystals have come to form the backbone of many display technologies. As such, most of us have seen liquid crystals, used them, included them in our daily routines, let them into our homes, and allowed our children to play around with them. This beckons an important question: {\it what} is a liquid crystal?
|
||||
\bigskip
|
||||
|
||||
\indent The term itself is an oxymoron. From a materials science point of view, a crystal is characterized by {\it order}, whereas a liquid is {\it disordered}. In a crystal, the constituent atoms or molecules form ordered, regular, periodic structures, as is illustrated in figure~\-\ref{fig:crystal}{\it a}. For example, the atoms in a sodium chloride crystal (more commonly known as salt) are arranged in a simple cubic pattern, which persists over visible, human scales. This means that the atoms in a grain of salt are almost all aligned according to this simple pattern. As a striking consequence, crystals naturally take on very regular geometric shapes. In the picture in figure~\-\ref{fig:crystal}{\it b}, one can see four pyrite crystals, each of which naturally assumes the shape of a cube. This is due to its cubic molecular structure. It is rather astonishing that the tens of billions of trillions of atoms in the sample in figure~\-\ref{fig:crystal}{\it b} are all lined up!
|
||||
\bigskip
|
||||
|
||||
\begin{figure}
|
||||
\hfil\includegraphics[width=6cm]{crystal.png}\hskip-20pt{\it\footnotesize a.}
|
||||
\hfil\vbox{\hbox{\includegraphics[width=6cm]{pyrite.jpg} {\it\footnotesize b.}}\vskip-3pt\hbox{\tiny photo: {\color{blue}\href{https://commons.wikimedia.org/wiki/File:Pyrite_from_Ampliación_a_Victoria_Mine,_Navajún,_La_Rioja,_Spain_2.jpg}{JJ Harrison}}, license: {\color{blue}\href{https://creativecommons.org/licenses/by-sa/3.0}{CC BY-SA 3.0}}}}
|
||||
\medskip
|
||||
\caption{%
|
||||
{\it a}. The microscopic structure of a sodium chloride (salt) crystal. The small purple spheres represent sodium atoms and the large green ones, chlorine. They form a regular cubic structure.\par
|
||||
{\it b}. A sample of pyrite, a mineral composed of iron and sulfure. It consists of four cubic crystals, melded together. The cubic structure of its molecular configuration determines the shape of the crystal. Note that this sample was not cut: pyrite naturally grows as cubes.
|
||||
}
|
||||
\label{fig:crystal}
|
||||
\end{figure}
|
||||
|
||||
\indent On the other hand, the atoms or molecules in a liquid are completely disorganized, as is depicted in figure~\-\ref{fig:liquid}. In other words there is no long range structure, which means that the position of a molecule is independent of molecules that are sufficiently far from it, and, as a consequence, there is much more freedom in the way they are arranged. On human scales, this implies that liquids are easily deformed, and, as a consequence, flow.
|
||||
\bigskip
|
||||
|
||||
\begin{figure}
|
||||
\hfil\includegraphics[width=8cm]{liquid.png}
|
||||
\medskip
|
||||
\caption{Idealized depiction of the atoms in a liquid. The configuration is disordered: it has no long range structure.}
|
||||
\label{fig:liquid}
|
||||
\end{figure}
|
||||
|
||||
\indent Liquid crystals lie somewhere between crystals and liquids. They have {\it order} properties specific to the former, as well as {\it disorder} properties of the latter. This is made possible by the anisotropy of the shapes of the molecules in liquid crystals. While there are other examples, let us focus on compounds whose molecules are shaped like rods, that is, they are long, thin and straight (see figure~\-\ref{fig:nematic}). Such compounds can be synthesized in the lab, and occur in nature as well: the tobacco mosaic virus, which affects tobacco plants and other nightshades, is a single strand of RNA nestled in a cylindrical shell of proteins, 15 times longer than it is wide. In this context, a liquid crystal phase is one in which the orientations of the molecules are ordered but their positions are disordered. There are several ways in which this can occur, but let us focus on {\it nematic} liquid crystals, an example of which is depicted in figure~\-\ref{fig:nematic}{\it a}. In this phase, most of the molecules point in the same direction, up to small local fluctuations. Similarly to the molecular arrangements in crystals, the molecules in a droplet of liquid crystal will nearly all point in the same direction, even though there may be billions of trillions of them. This is the {\it ordered} aspect of the configuration. On the other hand, the positions of the molecules has no long range structure. In other words, liquid crystals flow like a liquid.
|
||||
|
||||
\begin{figure}
|
||||
\hfil\includegraphics[width=8cm]{nematic.png}\hskip-20pt{\it\footnotesize a.}
|
||||
\hfil\includegraphics[width=8cm]{chiral.png}\hskip-20pt{\it\footnotesize b.}
|
||||
\medskip
|
||||
\caption{%
|
||||
{\it a}. Depiction of a nematic liquid crystal phase. Each molecule is represented by a long ellipsoid, which reflects its anisotropy. The molecules are mostly aligned, up to small, local fluctuations, but their positions are disordered.\par
|
||||
{\it b}. A chiral nematic liquid crystal phase. The molecules are arranged in horizontal layers. In each layer, they are aligned, and the direction of the alignment rotates from one layer to the next.
|
||||
}
|
||||
\label{fig:nematic}
|
||||
\end{figure}
|
||||
|
||||
\indent On human scales, the manifestation of this cohabitation of order and disorder properties is that, while liquid crystals flow like liquids and form droplets, the uniform orientation of its molecules gives them peculiar optical properties, that is, they interact with light in a non-trivial way. For instance, certain liquid crystals change colors as the temperature is varied. In fact, the changing colors of mood rings often come from a layer of liquid crystal under a transparent gemstone (which can be replaced by glass or plastic). Other liquid crystals change the {\it polarization} of light. Polarization is a property of light rays that is invisible to the naked eye, but plays an important role in many technological applications. Polarized light can be obtained from most common light sources (such as the sun and incandescent bulbs) by applying a simple, inexpensive filter. For example, the lenses of Polaroid sunglasses contain such filters, as do those in the glasses handed out at certain 3D movie theaters. Liquid crystals of the so-called {\it chiral nematic} type (see figure~\-\ref{fig:nematic}{\it b}) change light polarization. These liquid crystals are used to build simple electronic light filters, which are at the basis of LCD (Liquid Crystal Display) technologies.
|
||||
\bigskip
|
||||
|
||||
\indent Here, an `electronic light filter' should be understood as a device that is transparent at rest, and turns black and opaque when an electric current is run through it. Such a filter can be built by putting two polarizing filters around a chiral nematic liquid crystal. In order not to get into the physics of polarization, I will make an analogy that, while it does not capture the full depth of the theory, may be more intuitive. I will replace the light coming towards the device by a coin, and the polarizing filters by slots through which the coin must pass in order to reach the other side. The first slot is vertical, while the second is horizontal. The coin is initially vertical, but the chiral nematic liquid crystal rotates it by 90 degrees as it passes through it. Thus, the coin goes through the vertical slot and is rotated by the liquid crystal so that it can pass through the horizontal slot to the other side. Beyond the analogy, this means that light can go through the filter, which is, thereby, transparent. If an electrical current is run near the liquid crystal, it turns the chiral nematic phase (figure~\-\ref{fig:nematic}{\it b}) into a regular nematic phase (figure~\-\ref{fig:nematic}{\it a}), which does not change the polarization of light, and, in the analogy, does not rotate the coin. Thus, when a current is run through the device, the coin is still vertical when it reaches the horizontal slot and cannot fit through. Light cannot go through the filter, which turns black and opaque.
|
||||
\bigskip
|
||||
|
||||
\indent In digital watch displays, each digit is assigned seven rod-shaped electronic light filters. In order to display a number, the appropriate filters are switched on, which turns them black. The mechanism used in computer monitors, TVs and smartphones is slightly different, but conceptually similar. Images are broken up into several million colored dots, called {\it pixels}. Each one is a red, green or blue light source with an electronic light filter in front of it. By turning the appropriate filters on or off, the intensity of each pixel is adjusted, and an image is displayed.
|
||||
\bigskip
|
||||
|
||||
\indent Let us briefly summarize what we have so far: liquid crystals are materials that exhibit order in the orientations of their molecules, and disorder in their positions. They flow like liquids, and interact with light in intriguing and useful ways. From a scientific point of view, the natural next question is: {\it how} do liquid crystals exist? Put another way, can one find a model that adequately represents the molecules in a liquid crystal, in which one can {\it prove} that the molecules spontaneously align, and yet flow?
|
||||
\bigskip
|
||||
|
||||
\indent A partial answer was provided in the pioneering work of Lars Onsager in 1949, in which it was shown that, {\it under certain approximations}, systems of many long rods spontaneously form nematic liquid crystals. But without such approximations, little was known until 1979, when Ole Heilmann, a chemist from Copenhagen and Elliott H. Lieb, a mathematical physicist from Princeton University introduced a family of models which may have a provable liquid crystal phase. I will now describe one of these, which I will call the Heilmann-Lieb model. First of all, it is a two-dimensional model, that is, it describes a liquid crystal on a flat surface. Second, is is defined on a {\it grid}, so the molecules are restricted to a square mesh. The molecules are represented as length-1 rods on this grid, as shown in figure~\-\ref{fig:dimers}. They can only take one of two orientations: horizontal or vertical. In addition, we introduce forces between the rods which favor alignment. One can think of these interacting rods as magnetized sticks, which tend to align with their neighbors. Heilmann and Lieb proved that the rods spontaneously align in this model. Therefore, there is order in the orientation of the molecules. They did not prove that their positions are disordered, but conjectured it should be so. I will call this the {\it Heilmann-Lieb conjecture}.
|
||||
\bigskip
|
||||
|
||||
\begin{figure}
|
||||
\hfil\includegraphics[width=8cm]{interaction.pdf}
|
||||
\medskip
|
||||
\caption{A sample configuration in the Heilmann-Lieb model. The molecules are represented as rods. The forces between aligned neighboring rods are depicted as red wavy lines.}
|
||||
\label{fig:dimers}
|
||||
\end{figure}
|
||||
|
||||
\indent Since the Heilmann-Lieb conjecture was formulated, other models were introduced in which the existence of nematic liquid crystal phases was proved. In the fall of 2016, Elliott H. Lieb, who had formulated the conjecture in 1979, and I revisited the Heilmann-Lieb model, and have recently announced a proof of the conjecture. Thus, in the Heilmann-Lieb model, (in the appropriate range of parameters,) the molecules spontaneously align, and yet, they flow, which implies that the system behaves like a nematic liquid crystal.
|
||||
\bigskip
|
||||
|
||||
\indent But one important open question remains. In the Heilmann-Lieb model, the molecules can only take two orientations, whereas in a {\it real} liquid crystal, they can point in any direction. Can one find a {\it realistic} molecular model, in which the orientation of the molecules is unrestricted, for which a liquid crystal phase can be proved to exist? By improving our understanding of simplified models, such as those introduced by Heilmann and Lieb, we are inching closer to the answer.
|
||||
|
||||
\end{document}
|
60
Makefile
Normal file
60
Makefile
Normal file
@ -0,0 +1,60 @@
|
||||
PROJECTNAME=$(basename $(wildcard *.tex))
|
||||
LIBS=$(notdir $(wildcard libs/*))
|
||||
FIGS=$(notdir $(wildcard figs/*.fig))
|
||||
PICS=$(notdir $(wildcard figs/*.jpg))
|
||||
|
||||
PDFS=$(addsuffix .pdf, $(PROJECTNAME))
|
||||
SYNCTEXS=$(addsuffix .synctex.gz, $(PROJECTNAME))
|
||||
|
||||
all: $(PROJECTNAME)
|
||||
|
||||
$(PROJECTNAME): $(LIBS) $(FIGS) $(PICS)
|
||||
pdflatex -file-line-error $@.tex
|
||||
pdflatex -synctex=1 $@.tex
|
||||
|
||||
$(PROJECTNAME).aux: $(LIBS) $(FIGS) $(PICS)
|
||||
pdflatex -file-line-error -draftmode $(PROJECTNAME).tex
|
||||
|
||||
|
||||
$(SYNCTEXS): $(LIBS) $(FIGS) $(PICS)
|
||||
pdflatex -synctex=1 $(patsubst %.synctex.gz, %.tex, $@)
|
||||
|
||||
|
||||
libs: $(LIBS)
|
||||
|
||||
$(LIBS):
|
||||
ln -fs libs/$@ ./
|
||||
|
||||
figs: $(FIGS)
|
||||
|
||||
$(FIGS):
|
||||
make -C figs/$@
|
||||
for pdf in $$(find figs/$@/ -name '*.pdf'); do ln -fs "$$pdf" ./ ; done
|
||||
for png in $$(find figs/$@/ -name '*.png'); do ln -fs "$$png" ./ ; done
|
||||
|
||||
$(PICS):
|
||||
ln -fs figs/$@ ./
|
||||
|
||||
clean-aux: clean-figs-aux
|
||||
rm -f $(addsuffix .aux, $(PROJECTNAME))
|
||||
rm -f $(addsuffix .log, $(PROJECTNAME))
|
||||
rm -f $(addsuffix .out, $(PROJECTNAME))
|
||||
rm -f $(addsuffix .toc, $(PROJECTNAME))
|
||||
|
||||
clean-libs:
|
||||
rm -f $(LIBS)
|
||||
|
||||
clean-figs:
|
||||
$(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean; )
|
||||
rm -f $(notdir $(wildcard figs/*.fig/*.pdf))
|
||||
rm -f $(notdir $(wildcard figs/*.fig/*.png))
|
||||
rm -f $(PICS)
|
||||
|
||||
clean-figs-aux:
|
||||
$(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean-aux; )
|
||||
|
||||
|
||||
clean-tex:
|
||||
rm -f $(PDFS) $(SYNCTEXS)
|
||||
|
||||
clean: clean-aux clean-tex clean-libs clean-figs
|
53
README
Normal file
53
README
Normal file
@ -0,0 +1,53 @@
|
||||
This directory contains the source files to typeset the article, and generate
|
||||
the figures. This can be accomplished by running
|
||||
make
|
||||
|
||||
This document uses a custom class file, located in the 'libs' directory, which
|
||||
defines a number of commands. Most of these are drop-in replacements for those
|
||||
defined in the 'article' class.
|
||||
|
||||
Some extra functionality is provided in custom style files, located in the
|
||||
'libs' directory.
|
||||
|
||||
|
||||
* Dependencies:
|
||||
|
||||
pdflatex
|
||||
TeXlive packages:
|
||||
amsfonts
|
||||
color
|
||||
graphics
|
||||
hyperref
|
||||
latex
|
||||
marginnote
|
||||
pgf
|
||||
standalone
|
||||
GNU make
|
||||
python3
|
||||
gnuplot
|
||||
|
||||
* Files:
|
||||
|
||||
Jauslin-IASletter_2017.tex:
|
||||
main LaTeX file
|
||||
|
||||
libs:
|
||||
custom LaTeX class and style files
|
||||
|
||||
figs:
|
||||
source code for the figures
|
||||
|
||||
figs/pyrite.jpg:
|
||||
photo by: JJ Harrison
|
||||
https://commons.wikimedia.org/wiki/File:Pyrite_from_Ampliación_a_Victoria_Mine,_Navajún,_La_Rioja,_Spain_2.jpg
|
||||
licensed under Creative Commons BY-SA 3.0
|
||||
https://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
figs/dimer_example.fig/dimer_conf.py:
|
||||
this python script randomly generates a suitable dimer configuration for
|
||||
the figures interaction.pdf boundary.pdf bounding_loop.pdf and
|
||||
dimer_contour.pdf
|
||||
|
||||
figs/atoms.fig/*.py:
|
||||
these python script randomly generate nematic, chiral nematic and liquid
|
||||
configurations, as well as a deterministic crystalline configuration.
|
15
figs/atoms.fig/Makefile
Normal file
15
figs/atoms.fig/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
PROJECTNAME=nematic liquid crystal chiral
|
||||
PNGS=$(addsuffix .png, $(PROJECTNAME))
|
||||
|
||||
all: $(PNGS)
|
||||
|
||||
$(PNGS):
|
||||
cp $(patsubst %.png, %, $@)-base.gp $(patsubst %.png, %, $@).gp
|
||||
python $(patsubst %.png, %, $@).py >> $(patsubst %.png, %, $@).gp
|
||||
gnuplot $(patsubst %.png, %, $@).gp > $@
|
||||
|
||||
clean-aux:
|
||||
rm -f $(addsuffix .gp, $(PROJECTNAME))
|
||||
|
||||
clean: clean-aux
|
||||
rm -f $(PNGS)
|
22
figs/atoms.fig/chiral-base.gp
Normal file
22
figs/atoms.fig/chiral-base.gp
Normal file
@ -0,0 +1,22 @@
|
||||
set terminal pngcairo size 2048,2048
|
||||
|
||||
set key off
|
||||
unset colorbox
|
||||
unset border
|
||||
unset xtics
|
||||
unset ytics
|
||||
unset ztics
|
||||
|
||||
set parametric
|
||||
|
||||
set view 80,10,1.5
|
||||
set view equal xyz
|
||||
|
||||
set isosample 100
|
||||
|
||||
set pm3d depthorder
|
||||
set pm3d lighting primary 0.50 specular 0.6
|
||||
|
||||
set palette defined (0 "#339999", 1 "#339999")
|
||||
|
||||
splot \
|
102
figs/atoms.fig/chiral.py
Normal file
102
figs/atoms.fig/chiral.py
Normal file
@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from math import *
|
||||
import random
|
||||
import sys
|
||||
|
||||
# size of space
|
||||
L=30
|
||||
# number of lines
|
||||
H=5
|
||||
# heigh of lines
|
||||
height=5
|
||||
# number of rods per line
|
||||
N=16
|
||||
# aspect ratio
|
||||
a=10
|
||||
# spread in theta angle
|
||||
spread_t=pi/60
|
||||
# in phi
|
||||
spread_p=pi/60
|
||||
# in height
|
||||
spread_h=1/120
|
||||
|
||||
# check whether two rods overlap
|
||||
def check_overlap(rod1,rod2):
|
||||
# relative placement
|
||||
relative_pos=unrotate(subtract(rod2[0],rod1[0]), rod1[1])
|
||||
if(abs(relative_pos[0])<2 and abs(relative_pos[1])<2 and abs(relative_pos[2])<2):
|
||||
return(True)
|
||||
# relative angle
|
||||
relative_ang=cart_to_spherical(unrotate(spherical_to_cart(rod2[1]), rod1[1]))
|
||||
# exclusion volume
|
||||
# rotate other rod
|
||||
relative_pos=unrotate(relative_pos, [0,relative_ang[1]])
|
||||
#if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(relative_pos[2])-a-2<abs(cos(relative_ang[0])*a)):
|
||||
if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(sin(relative_ang[0])*relative_pos[2]-cos(relative_ang[0])*relative_pos[0])-2<abs(sin(relative_ang[0])*a)):
|
||||
return(True)
|
||||
return(False)
|
||||
|
||||
# def subtract vectors
|
||||
def subtract(x,y):
|
||||
return([x[0]-y[0],x[1]-y[1],x[2]-y[2]])
|
||||
# rotate vector
|
||||
def unrotate(x,w):
|
||||
ret=[x[0],x[1],x[2]]
|
||||
# rotate phi
|
||||
tmp=cos(w[1])*ret[0]+sin(w[1])*ret[1]
|
||||
ret[1]=-sin(w[1])*ret[0]+cos(w[1])*ret[1]
|
||||
ret[0]=tmp
|
||||
# rotate theta
|
||||
tmp=cos(w[0])*ret[0]-sin(w[0])*ret[2]
|
||||
ret[2]=sin(w[0])*ret[0]+cos(w[0])*ret[2]
|
||||
ret[0]=tmp
|
||||
return(ret)
|
||||
|
||||
# convert coordinates
|
||||
def spherical_to_cart(w):
|
||||
return([cos(w[1])*sin(w[0]),sin(w[1])*sin(w[0]),cos(w[0])])
|
||||
def cart_to_spherical(x):
|
||||
w=[0,0]
|
||||
w[0]=acos(x[2])
|
||||
if(sin(w[0]==0)):
|
||||
return([w[0],0])
|
||||
c=x[0]/sin(w[0])
|
||||
s=x[1]/sin(w[0])
|
||||
# to avoid truncation errors
|
||||
if(abs(c)>1 and abs(c)<1.0001):
|
||||
if(c>0):
|
||||
return([w[0],0])
|
||||
else:
|
||||
return([w[0],pi])
|
||||
if(s>=0):
|
||||
return([w[0],acos(c)])
|
||||
return([w[0],2*pi-acos(c)])
|
||||
|
||||
# configuration
|
||||
config=[]
|
||||
# add rods
|
||||
for h in range(H):
|
||||
config_h=[]
|
||||
while len(config_h)<N:
|
||||
# random position and angles
|
||||
x=[random.uniform(0,L), random.uniform(0,L), random.gauss(h*height,spread_h)]
|
||||
w=[abs(random.gauss(pi/2,spread_t)), random.gauss(pi/2*(1-h/(H-1)),spread_p)]
|
||||
# chek it does not interfere with other rods
|
||||
fine=True
|
||||
for rod in config+config_h:
|
||||
if(check_overlap(rod,[x,w])):
|
||||
fine=False
|
||||
break
|
||||
if fine:
|
||||
config_h.append([x,w])
|
||||
config=config+config_h
|
||||
|
||||
for i in range(len(config)):
|
||||
rod=config[i]
|
||||
print(str(rod[0][0])+"+("+str(cos(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(-sin(rod[1][1]))+")*sin(u)*sin(v)+("+str(cos(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ")
|
||||
print(str(rod[0][1])+"+("+str(sin(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][1]))+")*sin(u)*sin(v)+("+str(sin(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ")
|
||||
print(str(rod[0][2])+"+("+str(-sin(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][0])*a)+")*cos(v)", end=" ")
|
||||
print("with pm3d", end="")
|
||||
if i<len(config)-1:
|
||||
print(", \\")
|
21
figs/atoms.fig/crystal-base.gp
Normal file
21
figs/atoms.fig/crystal-base.gp
Normal file
@ -0,0 +1,21 @@
|
||||
set terminal pngcairo size 2048,2048
|
||||
|
||||
set key off
|
||||
unset colorbox
|
||||
unset border
|
||||
unset xtics
|
||||
unset ytics
|
||||
unset ztics
|
||||
|
||||
set parametric
|
||||
|
||||
set view equal xyz
|
||||
|
||||
set isosample 100
|
||||
|
||||
set pm3d depthorder
|
||||
set pm3d lighting primary 0.50 specular 0.6
|
||||
|
||||
set palette defined (0 "#ff00ff", 1 "#00ff00")
|
||||
|
||||
splot \
|
26
figs/atoms.fig/crystal.py
Normal file
26
figs/atoms.fig/crystal.py
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from math import *
|
||||
import random
|
||||
import sys
|
||||
|
||||
# number of Cl atoms
|
||||
N=5
|
||||
|
||||
for i in range(N):
|
||||
for j in range(N):
|
||||
for k in range(N):
|
||||
if ((i+j+k)%2==0):
|
||||
color=1
|
||||
size=1
|
||||
else:
|
||||
color=0
|
||||
size=0.5
|
||||
print("'++' u", end=" ")
|
||||
print("("+str(1.5*i)+"+("+str(size)+")*cos($1)*sin($2))", end=":")
|
||||
print("("+str(1.5*j)+"+("+str(size)+")*sin($1)*sin($2))", end=":")
|
||||
print("("+str(1.5*k)+"+("+str(size)+")*cos($2))", end=":")
|
||||
print("("+str(color)+")", end=" ")
|
||||
print("with pm3d", end="")
|
||||
if i<N**3-1:
|
||||
print(", \\")
|
21
figs/atoms.fig/liquid-base.gp
Normal file
21
figs/atoms.fig/liquid-base.gp
Normal file
@ -0,0 +1,21 @@
|
||||
set terminal pngcairo size 2048,2048
|
||||
|
||||
set key off
|
||||
unset colorbox
|
||||
unset border
|
||||
unset xtics
|
||||
unset ytics
|
||||
unset ztics
|
||||
|
||||
set parametric
|
||||
|
||||
set view equal xyz
|
||||
|
||||
set isosample 100
|
||||
|
||||
set pm3d depthorder
|
||||
set pm3d lighting primary 0.50 specular 0.6
|
||||
|
||||
set palette defined (0 "#339999", 1 "#339999")
|
||||
|
||||
splot \
|
39
figs/atoms.fig/liquid.py
Normal file
39
figs/atoms.fig/liquid.py
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from math import *
|
||||
import random
|
||||
|
||||
# size of space
|
||||
L=15
|
||||
# number of particles
|
||||
N=100
|
||||
|
||||
# check whether two rods overlap
|
||||
def check_overlap(sphere1,sphere2):
|
||||
if(sqrt((sphere2[0]-sphere1[0])**2+(sphere2[1]-sphere1[1])**2+(sphere2[2]-sphere1[2])**2)<2):
|
||||
return(True)
|
||||
return(False)
|
||||
|
||||
# configuration
|
||||
config=[]
|
||||
# add spheres
|
||||
while len(config)<N:
|
||||
# random position
|
||||
x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)]
|
||||
# check it does not interfere with other spheres
|
||||
fine=True
|
||||
for sphere in config:
|
||||
if(check_overlap(sphere,x)):
|
||||
fine=False
|
||||
break
|
||||
if fine:
|
||||
config.append(x)
|
||||
|
||||
for i in range(len(config)):
|
||||
sphere=config[i]
|
||||
print(str(sphere[0])+"+cos(u)*sin(v)", end=", ")
|
||||
print(str(sphere[1])+"+sin(u)*sin(v)", end=", ")
|
||||
print(str(sphere[2])+"+cos(v)", end=" ")
|
||||
print("with pm3d", end="")
|
||||
if i<len(config)-1:
|
||||
print(", \\")
|
21
figs/atoms.fig/nematic-base.gp
Normal file
21
figs/atoms.fig/nematic-base.gp
Normal file
@ -0,0 +1,21 @@
|
||||
set terminal pngcairo size 2048,2048
|
||||
|
||||
set key off
|
||||
unset colorbox
|
||||
unset border
|
||||
unset xtics
|
||||
unset ytics
|
||||
unset ztics
|
||||
|
||||
set parametric
|
||||
|
||||
set view equal xyz
|
||||
|
||||
set isosample 100
|
||||
|
||||
set pm3d depthorder
|
||||
set pm3d lighting primary 0.50 specular 0.6
|
||||
|
||||
set palette defined (0 "#339999", 1 "#339999")
|
||||
|
||||
splot \
|
90
figs/atoms.fig/nematic.py
Normal file
90
figs/atoms.fig/nematic.py
Normal file
@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from math import *
|
||||
import random
|
||||
|
||||
# size of space
|
||||
L=30
|
||||
# number of rods
|
||||
N=75
|
||||
# aspect ratio
|
||||
a=10
|
||||
# spread in theta angle
|
||||
spread=pi/30
|
||||
|
||||
# check whether two rods overlap
|
||||
def check_overlap(rod1,rod2):
|
||||
# relative placement
|
||||
relative_pos=unrotate(subtract(rod2[0],rod1[0]), rod1[1])
|
||||
if(abs(relative_pos[0])<2 and abs(relative_pos[1])<2 and abs(relative_pos[2])<2):
|
||||
return(True)
|
||||
# relative angle
|
||||
relative_ang=cart_to_spherical(unrotate(spherical_to_cart(rod2[1]), rod1[1]))
|
||||
# exclusion volume
|
||||
# rotate other rod
|
||||
relative_pos=unrotate(relative_pos, [0,relative_ang[1]])
|
||||
#if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(relative_pos[2])-a-2<abs(cos(relative_ang[0])*a)):
|
||||
if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(sin(relative_ang[0])*relative_pos[2]-cos(relative_ang[0])*relative_pos[0])-2<abs(sin(relative_ang[0])*a)):
|
||||
return(True)
|
||||
return(False)
|
||||
|
||||
# def subtract vectors
|
||||
def subtract(x,y):
|
||||
return([x[0]-y[0],x[1]-y[1],x[2]-y[2]])
|
||||
# rotate vector
|
||||
def unrotate(x,w):
|
||||
ret=[x[0],x[1],x[2]]
|
||||
# rotate phi
|
||||
tmp=cos(w[1])*ret[0]+sin(w[1])*ret[1]
|
||||
ret[1]=-sin(w[1])*ret[0]+cos(w[1])*ret[1]
|
||||
ret[0]=tmp
|
||||
# rotate theta
|
||||
tmp=cos(w[0])*ret[0]-sin(w[0])*ret[2]
|
||||
ret[2]=sin(w[0])*ret[0]+cos(w[0])*ret[2]
|
||||
ret[0]=tmp
|
||||
return(ret)
|
||||
|
||||
# convert coordinates
|
||||
def spherical_to_cart(w):
|
||||
return([cos(w[1])*sin(w[0]),sin(w[1])*sin(w[0]),cos(w[0])])
|
||||
def cart_to_spherical(x):
|
||||
w=[0,0]
|
||||
w[0]=acos(x[2])
|
||||
if(sin(w[0]==0)):
|
||||
return([w[0],0])
|
||||
c=x[0]/sin(w[0])
|
||||
s=x[1]/sin(w[0])
|
||||
# to avoid truncation errors
|
||||
if(abs(c)>1 and abs(c)<1.0001):
|
||||
if(c>0):
|
||||
return([w[0],0])
|
||||
else:
|
||||
return([w[0],pi])
|
||||
if(s>=0):
|
||||
return([w[0],acos(c)])
|
||||
return([w[0],2*pi-acos(c)])
|
||||
|
||||
# configuration
|
||||
config=[]
|
||||
# add rods
|
||||
while len(config)<N:
|
||||
# random position and angles
|
||||
x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)]
|
||||
w=[abs(random.gauss(0,spread)), random.uniform(0,2*pi)]
|
||||
# chek it does not interfere with other rods
|
||||
fine=True
|
||||
for rod in config:
|
||||
if(check_overlap(rod,[x,w])):
|
||||
fine=False
|
||||
break
|
||||
if fine:
|
||||
config.append([x,w])
|
||||
|
||||
for i in range(len(config)):
|
||||
rod=config[i]
|
||||
print(str(rod[0][0])+"+("+str(cos(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(-sin(rod[1][1]))+")*sin(u)*sin(v)+("+str(cos(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ")
|
||||
print(str(rod[0][1])+"+("+str(sin(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][1]))+")*sin(u)*sin(v)+("+str(sin(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ")
|
||||
print(str(rod[0][2])+"+("+str(-sin(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][0])*a)+")*cos(v)", end=" ")
|
||||
print("with pm3d", end="")
|
||||
if i<len(config)-1:
|
||||
print(", \\")
|
32
figs/dimer_example.fig/Makefile
Normal file
32
figs/dimer_example.fig/Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
PROJECTNAME=interaction
|
||||
LIBS=$(notdir $(wildcard libs/*))
|
||||
|
||||
PDFS=$(addsuffix .pdf, $(PROJECTNAME))
|
||||
SOURCES=$(addsuffix .tikz.tex, $(PROJECTNAME))
|
||||
|
||||
all: $(PDFS)
|
||||
|
||||
$(PDFS): $(SOURCES) $(LIBS)
|
||||
echo $(LIBS)
|
||||
pdflatex -jobname $(basename $@) -file-line-error $(patsubst %.pdf, %.tikz.tex, $@)
|
||||
|
||||
$(SOURCES):
|
||||
python3 dimer_conf.py
|
||||
|
||||
$(LIBS):
|
||||
ln -fs libs/$@ ./
|
||||
|
||||
clean-libs:
|
||||
rm -f $(LIBS)
|
||||
|
||||
clean-aux:
|
||||
rm -f $(addsuffix .aux, $(PROJECTNAME))
|
||||
rm -f $(addsuffix .log, $(PROJECTNAME))
|
||||
|
||||
clean-tex:
|
||||
rm -f $(PDFS)
|
||||
|
||||
clean-sources:
|
||||
rm -f $(SOURCES)
|
||||
|
||||
clean: clean-libs clean-aux clean-tex clean-sources
|
167
figs/dimer_example.fig/dimer_conf.py
Normal file
167
figs/dimer_example.fig/dimer_conf.py
Normal file
@ -0,0 +1,167 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import random
|
||||
from math import *
|
||||
|
||||
# size of the grid
|
||||
L=24
|
||||
# boundary thickness (must be even)
|
||||
l0=4
|
||||
# activity and interaction
|
||||
z=3
|
||||
J=5
|
||||
|
||||
|
||||
# draw random dimers in a select area
|
||||
def fill_dimers(mask,direction):
|
||||
if(direction=="h"):
|
||||
d=[1,0]
|
||||
else:
|
||||
d=[0,1]
|
||||
|
||||
dimers=[]
|
||||
|
||||
# keep track of which sites are occupied
|
||||
occupied=[]
|
||||
for i in range(L):
|
||||
occupied.append([])
|
||||
for j in range(L):
|
||||
occupied[i].append(0)
|
||||
|
||||
for i in range(10000):
|
||||
# pick a random edge (indexed by its lower-left corner)
|
||||
e=None
|
||||
while(e==None or e[0]+d[0]>=L or e[1]+d[1]>=L or mask[e[0]][e[1]]==0 or mask[e[0]+d[0]][e[1]+d[1]]==0):
|
||||
e=[random.randint(0,L-1),random.randint(0,L-1)]
|
||||
# check whether a dimer can be added to the edge
|
||||
if(occupied[e[0]][e[1]]==0 and occupied[e[0]+d[0]][e[1]+d[1]]==0):
|
||||
# number of interactions
|
||||
interactions=0
|
||||
if(e[0]+2*d[0]<L and e[1]+2*d[1]<L and occupied[e[0]+2*d[0]][e[1]+2*d[1]]==1):
|
||||
interactions=interactions+1
|
||||
if(e[0]-d[0]>=0 and e[1]-d[1]>=0 and occupied[e[0]-d[0]][e[1]-d[1]]==1):
|
||||
interactions=interactions+1
|
||||
# probability of adding the dimer
|
||||
p=1/(1+1/z*exp(-J*interactions))
|
||||
if(p>random.random()):
|
||||
# add dimer
|
||||
dimers.append(e)
|
||||
occupied[e[0]][e[1]]=1
|
||||
occupied[e[0]+d[0]][e[1]+d[1]]=1
|
||||
|
||||
return(dimers)
|
||||
|
||||
# find interactions
|
||||
def interactions(dimers,direction):
|
||||
if(direction=="h"):
|
||||
d=[1,0]
|
||||
else:
|
||||
d=[0,1]
|
||||
|
||||
out=[]
|
||||
for d1 in dimers:
|
||||
for d2 in dimers:
|
||||
if(d1[0]-d2[0]==2*d[0] and d1[1]-d2[1]==2*d[1]):
|
||||
out.append([d2[0]+d[0],d2[1]+d[1]])
|
||||
return(out)
|
||||
|
||||
|
||||
# draw dimers
|
||||
def draw_dimers(v_dimers,h_dimers,file_desc,color):
|
||||
for d in v_dimers:
|
||||
print("\\dimer{[color="+color+"]("+str(d[0])+","+str(d[1])+")}v", file=file_desc)
|
||||
print("", file=file_desc)
|
||||
for d in h_dimers:
|
||||
print("\\dimer{[color="+color+"]("+str(d[0])+","+str(d[1])+")}h", file=file_desc)
|
||||
print("", file=file_desc)
|
||||
|
||||
# draw interactions
|
||||
def draw_interactions(v_interactions,h_interactions,file_desc):
|
||||
for d in v_interactions:
|
||||
print("\\interaction{("+str(d[0])+","+str(d[1])+")}v", file=file_desc)
|
||||
print("", file=file_desc)
|
||||
for d in h_interactions:
|
||||
print("\\interaction{("+str(d[0])+","+str(d[1])+")}h", file=file_desc)
|
||||
print("", file=file_desc)
|
||||
|
||||
# init tikz file
|
||||
def init_tikz(filename):
|
||||
file_desc=open(filename,"w")
|
||||
print("\\documentclass{standalone}\n\n\\usepackage{tikz}\n\\usepackage{dimer}\n\\usetikzlibrary{decorations.pathmorphing}\n\n\\begin{document}\n\\begin{tikzpicture}\n\n", file=file_desc)
|
||||
return(file_desc)
|
||||
|
||||
# close tikz file
|
||||
def close_tikz(file_desc):
|
||||
print("\\end{tikzpicture}\n\\end{document}", file=file_desc)
|
||||
file_desc.close()
|
||||
|
||||
mu=int(L/2)
|
||||
|
||||
|
||||
# masks
|
||||
# init
|
||||
v_mask=[]
|
||||
h_mask=[]
|
||||
for i in range(L):
|
||||
v_mask.append([])
|
||||
h_mask.append([])
|
||||
for j in range(L):
|
||||
v_mask[i].append(1)
|
||||
h_mask[i].append(0)
|
||||
# draw masks
|
||||
for i in range(mu-l0,mu+l0):
|
||||
for j in range(mu+1,mu+5):
|
||||
v_mask[i][j]=0
|
||||
for i in range(mu-2*l0,mu+2*l0):
|
||||
for j in range(mu-5,mu+1):
|
||||
v_mask[i][j]=0
|
||||
for i in range(mu-l0+2,mu+l0-2):
|
||||
for j in range(mu+1,mu+4):
|
||||
h_mask[i][j]=1
|
||||
for i in range(mu-l0,mu+l0):
|
||||
h_mask[i][mu]=1
|
||||
for i in range(mu-2*l0+2,mu+2*l0-2):
|
||||
for j in range(mu-4,mu):
|
||||
h_mask[i][j]=1
|
||||
h_mask[mu-1][mu+1]=0
|
||||
h_mask[mu-1][mu+2]=0
|
||||
h_mask[mu-1][mu-3]=0
|
||||
h_mask[mu-1][mu-2]=0
|
||||
h_mask[mu][mu-3]=0
|
||||
h_mask[mu][mu-2]=0
|
||||
|
||||
# random dimers in mask
|
||||
v_dimers=fill_dimers(v_mask,"v")
|
||||
h_dimers=fill_dimers(h_mask,"h")
|
||||
|
||||
# mantle dimers
|
||||
h_mantle=[]
|
||||
for i in range(0,l0):
|
||||
h_mantle.append([mu-l0+2*i,mu+4])
|
||||
for i in range(0,4):
|
||||
h_mantle.append([mu+l0-2,mu+4-i])
|
||||
h_mantle.append([mu-l0,mu+4-i])
|
||||
for i in range(0,int(l0/2)):
|
||||
h_mantle.append([mu+l0+2*i,mu])
|
||||
h_mantle.append([mu-l0-2-2*i,mu])
|
||||
for i in range(0,5):
|
||||
h_mantle.append([mu+2*l0-2,mu-i])
|
||||
h_mantle.append([mu-2*l0,mu-i])
|
||||
for i in range(0,2*l0):
|
||||
h_mantle.append([mu-2*l0+2*i,mu-5])
|
||||
|
||||
v_mantle=[]
|
||||
v_mantle.append([mu-1,mu+1])
|
||||
v_mantle.append([mu-1,mu-3])
|
||||
v_mantle.append([mu,mu-3])
|
||||
|
||||
# interactions
|
||||
v_interactions=interactions(v_dimers+v_mantle,"v")
|
||||
h_interactions=interactions(h_dimers+h_mantle,"h")
|
||||
|
||||
# files
|
||||
interaction=init_tikz("interaction.tikz.tex")
|
||||
print("\\grid{"+str(L-1)+"}{"+str(L-1)+"}{(0,0)}\n", file=interaction)
|
||||
draw_interactions(v_interactions,h_interactions,interaction)
|
||||
draw_dimers(v_dimers+v_mantle,h_dimers+h_mantle,interaction,"black")
|
||||
close_tikz(interaction)
|
33
figs/dimer_example.fig/libs/dimer.sty
Normal file
33
figs/dimer_example.fig/libs/dimer.sty
Normal file
@ -0,0 +1,33 @@
|
||||
% square lattice (width #1, height #2, origin #3)
|
||||
\def\grid#1#2#3{
|
||||
\foreach\i in {0,...,#2}{
|
||||
\draw#3++(0,\i)--++(#1,0);
|
||||
}
|
||||
\foreach\i in {0,...,#1}{
|
||||
\draw#3++(\i,0)--++(0,#2);
|
||||
}
|
||||
}
|
||||
|
||||
% dimer (bottom-left vertex #1, vertical or horizontal #2)
|
||||
\def\dimer#1#2{
|
||||
\if#2h
|
||||
\draw[line width=5pt]#1--++(1,0);
|
||||
\fill#1circle(7pt);
|
||||
\fill#1++(1,0)circle(7pt);
|
||||
\else
|
||||
\draw[line width=5pt]#1--++(0,1);
|
||||
\fill#1circle(7pt);
|
||||
\fill#1++(0,1)circle(7pt);
|
||||
\fi
|
||||
}
|
||||
|
||||
% interactions (bottom-left vertex #1, vertical or horizontal #2)
|
||||
\def\interaction#1#2{
|
||||
\if#2h
|
||||
\draw[line width=5pt, color=white]#1--++(1,0);
|
||||
\draw[line width=4pt, decorate, decoration={snake}, color=red]#1--++(1,0);
|
||||
\else
|
||||
\draw[line width=5pt, color=white]#1--++(0,1);
|
||||
\draw[line width=4pt, decorate, decoration={snake}, color=red]#1--++(0,1);
|
||||
\fi
|
||||
}
|
BIN
figs/pyrite.jpg
Normal file
BIN
figs/pyrite.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
659
libs/ian.cls
Normal file
659
libs/ian.cls
Normal file
@ -0,0 +1,659 @@
|
||||
%%
|
||||
%% Ian's class file
|
||||
%%
|
||||
|
||||
%% TeX format
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
|
||||
%% class name
|
||||
\ProvidesClass{ian}[2017/09/29]
|
||||
|
||||
%% boolean to signal that this class is being used
|
||||
\newif\ifianclass
|
||||
|
||||
%% options
|
||||
% no section numbering in equations
|
||||
\DeclareOption{section_in_eq}{\sectionsineqtrue}
|
||||
\DeclareOption{section_in_fig}{\sectionsinfigtrue}
|
||||
\DeclareOption{section_in_theo}{\PassOptionsToPackage{\CurrentOption}{iantheo}}
|
||||
\DeclareOption{section_in_all}{\sectionsineqtrue\sectionsinfigtrue\PassOptionsToPackage{section_in_theo}{iantheo}}
|
||||
\DeclareOption{subsection_in_eq}{\subsectionsineqtrue}
|
||||
\DeclareOption{subsection_in_fig}{\subsectionsinfigtrue}
|
||||
\DeclareOption{subsection_in_theo}{\PassOptionsToPackage{\CurrentOption}{iantheo}}
|
||||
\DeclareOption{subsection_in_all}{\subsectionsineqtrue\subsectionsinfigtrue\PassOptionsToPackage{subsection_in_theo}{iantheo}}
|
||||
\DeclareOption{no_section_in_eq}{\sectionsineqfalse}
|
||||
\DeclareOption{no_section_in_fig}{\sectionsinfigfalse}
|
||||
\DeclareOption{no_section_in_theo}{\PassOptionsToPackage{\CurrentOption}{iantheo}}
|
||||
\DeclareOption{no_section_in_all}{\sectionsineqfalse\sectionsinfigfalse\PassOptionsToPackage{no_section_in_theo}{iantheo}}
|
||||
\DeclareOption{no_subsection_in_eq}{\subsectionsineqfalse}
|
||||
\DeclareOption{no_subsection_in_fig}{\subsectionsinfigfalse}
|
||||
\DeclareOption{no_subsection_in_theo}{\PassOptionsToPackage{\CurrentOption}{iantheo}}
|
||||
\DeclareOption{no_subsection_in_all}{\subsectionsineqfalse\subsectionsinfigfalse\PassOptionsToPackage{no_subsection_in_theo}{iantheo}}
|
||||
% reset point
|
||||
\DeclareOption{point_reset_at_section}{\PassOptionsToPackage{reset_at_section}{point}}
|
||||
\DeclareOption{point_no_reset_at_section}{\PassOptionsToPackage{no_reset_at_section}{point}}
|
||||
\DeclareOption{point_reset_at_theo}{\PassOptionsToPackage{reset_at_theo}{point}}
|
||||
\DeclareOption{point_no_reset_at_theo}{\PassOptionsToPackage{no_reset_at_theo}{point}}
|
||||
|
||||
\def\ian@defaultoptions{
|
||||
\ExecuteOptions{section_in_all, no_subsection_in_all}
|
||||
\ProcessOptions
|
||||
|
||||
%% required packages
|
||||
\RequirePackage{iantheo}
|
||||
\RequirePackage{point}
|
||||
\RequirePackage{color}
|
||||
\RequirePackage{marginnote}
|
||||
\RequirePackage{amssymb}
|
||||
\PassOptionsToPackage{hidelinks}{hyperref}
|
||||
\RequirePackage{hyperref}
|
||||
}
|
||||
|
||||
%% paper dimensions
|
||||
\setlength\paperheight{297mm}
|
||||
\setlength\paperwidth{210mm}
|
||||
|
||||
%% fonts
|
||||
\input{size11.clo}
|
||||
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
|
||||
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
|
||||
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
|
||||
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
|
||||
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
|
||||
|
||||
%% text dimensions
|
||||
\hoffset=-50pt
|
||||
\voffset=-72pt
|
||||
\textwidth=460pt
|
||||
\textheight=704pt
|
||||
|
||||
|
||||
%% remove default indentation
|
||||
\parindent=0pt
|
||||
%% indent command
|
||||
\def\indent{\hskip20pt}
|
||||
|
||||
%% something is wrong with \thepage, redefine it
|
||||
\gdef\thepage{\the\c@page}
|
||||
|
||||
%% array lines (to use the array environment)
|
||||
\setlength\arraycolsep{5\p@}
|
||||
\setlength\arrayrulewidth{.4\p@}
|
||||
|
||||
|
||||
%% correct vertical alignment at the end of a document
|
||||
\AtEndDocument{
|
||||
\vfill
|
||||
\eject
|
||||
}
|
||||
|
||||
|
||||
%% hyperlinks
|
||||
% hyperlinkcounter
|
||||
\newcounter{lncount}
|
||||
% hyperref anchor
|
||||
\def\hrefanchor{%
|
||||
\stepcounter{lncount}%
|
||||
\hypertarget{ln.\thelncount}{}%
|
||||
}
|
||||
|
||||
%% define a command and write it to aux file
|
||||
\def\outdef#1#2{%
|
||||
% define command%
|
||||
\expandafter\xdef\csname #1\endcsname{#2}%
|
||||
% hyperlink number%
|
||||
\expandafter\xdef\csname #1@hl\endcsname{\thelncount}%
|
||||
% write command to aux%
|
||||
\immediate\write\@auxout{\noexpand\expandafter\noexpand\gdef\noexpand\csname #1\endcsname{\csname #1\endcsname}}%
|
||||
\immediate\write\@auxout{\noexpand\expandafter\noexpand\gdef\noexpand\csname #1@hl\endcsname{\thelncount}}%
|
||||
}
|
||||
|
||||
%% can call commands even when they are not defined
|
||||
\def\safe#1{%
|
||||
\ifdefined#1%
|
||||
#1%
|
||||
\else%
|
||||
{\color{red}\bf?}%
|
||||
\fi%
|
||||
}
|
||||
|
||||
%% define a label for the latest tag
|
||||
%% label defines a command containing the string stored in \tag
|
||||
\def\deflabel{
|
||||
\def\label##1{\expandafter\outdef{label@##1}{\safe\tag}}
|
||||
|
||||
\def\ref##1{%
|
||||
% check whether the label is defined (hyperlink runs into errors if this check is omitted)
|
||||
\ifcsname label@##1@hl\endcsname%
|
||||
\hyperlink{ln.\csname label@##1@hl\endcsname}{{\color{blue}\safe\csname label@##1\endcsname}}%
|
||||
\else%
|
||||
\ifcsname label@##1\endcsname%
|
||||
{\color{blue}\csname ##1\endcsname}%
|
||||
\else%
|
||||
{\bf ??}%
|
||||
\fi%
|
||||
\fi%
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%% make a custom link at any given location in the document
|
||||
\def\makelink#1#2{%
|
||||
\hrefanchor%
|
||||
\outdef{label@#1}{#2}%
|
||||
}
|
||||
|
||||
|
||||
%% section command
|
||||
% counter
|
||||
\newcounter{sectioncount}
|
||||
% space before section
|
||||
\newlength\secskip
|
||||
\setlength\secskip{40pt}
|
||||
% a prefix to put before the section number, e.g. A for appendices
|
||||
\def\sectionprefix{}
|
||||
% define some lengths
|
||||
\newlength\secnumwidth
|
||||
\newlength\sectitlewidth
|
||||
\def\section#1{
|
||||
% reset counters
|
||||
\stepcounter{sectioncount}
|
||||
\setcounter{subsectioncount}{0}
|
||||
\ifsectionsineq
|
||||
\setcounter{seqcount}0
|
||||
\fi
|
||||
\ifsectionsinfig
|
||||
\setcounter{figcount}0
|
||||
\fi
|
||||
|
||||
% space before section (if not first)
|
||||
\ifnum\thesectioncount>1
|
||||
\vskip\secskip
|
||||
\penalty-1000
|
||||
\fi
|
||||
|
||||
% hyperref anchor
|
||||
\hrefanchor
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\sectionprefix\thesectioncount}
|
||||
|
||||
% get widths
|
||||
\def\@secnum{{\bf\Large\sectionprefix\thesectioncount.\hskip10pt}}
|
||||
\settowidth\secnumwidth{\@secnum}
|
||||
\setlength\sectitlewidth\textwidth
|
||||
\addtolength\sectitlewidth{-\secnumwidth}
|
||||
|
||||
% print name
|
||||
\parbox{\textwidth}{
|
||||
\@secnum
|
||||
\parbox[t]{\sectitlewidth}{\Large\bf #1}}
|
||||
|
||||
% write to table of contents
|
||||
\iftoc
|
||||
% save lncount in aux variable which is written to toc
|
||||
\immediate\write\tocoutput{\noexpand\expandafter\noexpand\edef\noexpand\csname toc@sec.\thesectioncount\endcsname{\thelncount}}
|
||||
\write\tocoutput{\noexpand\tocsection{#1}{\thepage}}
|
||||
\fi
|
||||
|
||||
%space
|
||||
\par\penalty10000
|
||||
\bigskip\penalty10000
|
||||
}
|
||||
|
||||
%% subsection
|
||||
% counter
|
||||
\newcounter{subsectioncount}
|
||||
% space before subsection
|
||||
\newlength\subsecskip
|
||||
\setlength\subsecskip{30pt}
|
||||
\def\subsection#1{
|
||||
% counters
|
||||
\stepcounter{subsectioncount}
|
||||
\setcounter{subsubsectioncount}{0}
|
||||
\ifsubsectionsineq
|
||||
\setcounter{seqcount}0
|
||||
\fi
|
||||
\ifsubsectionsinfig
|
||||
\setcounter{figcount}0
|
||||
\fi
|
||||
|
||||
% space before subsection (if not first)
|
||||
\ifnum\thesubsectioncount>1
|
||||
\vskip\subsecskip
|
||||
\penalty-500
|
||||
\fi
|
||||
|
||||
% hyperref anchor
|
||||
\hrefanchor
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\sectionprefix\thesectioncount.\thesubsectioncount}
|
||||
|
||||
% get widths
|
||||
\def\@secnum{{\bf\large\hskip.5cm\sectionprefix\thesectioncount.\thesubsectioncount.\hskip5pt}}
|
||||
\settowidth\secnumwidth{\@secnum}
|
||||
\setlength\sectitlewidth\textwidth
|
||||
\addtolength\sectitlewidth{-\secnumwidth}
|
||||
% print name
|
||||
\parbox{\textwidth}{
|
||||
\@secnum
|
||||
\parbox[t]{\sectitlewidth}{\large\bf #1}}
|
||||
|
||||
% write to table of contents
|
||||
\iftoc
|
||||
% save lncount in aux variable which is written to toc
|
||||
\immediate\write\tocoutput{\noexpand\expandafter\noexpand\edef\noexpand\csname toc@subsec.\thesectioncount.\thesubsectioncount\endcsname{\thelncount}}
|
||||
\write\tocoutput{\noexpand\tocsubsection{#1}{\thepage}}
|
||||
\fi
|
||||
|
||||
% space
|
||||
\par\penalty10000
|
||||
\medskip\penalty10000
|
||||
}
|
||||
|
||||
%% subsubsection
|
||||
% counter
|
||||
\newcounter{subsubsectioncount}
|
||||
% space before subsubsection
|
||||
\newlength\subsubsecskip
|
||||
\setlength\subsubsecskip{20pt}
|
||||
\def\subsubsection#1{
|
||||
% counters
|
||||
\stepcounter{subsubsectioncount}
|
||||
|
||||
% space before subsubsection (if not first)
|
||||
\ifnum\thesubsubsectioncount>1
|
||||
\vskip\subsubsecskip
|
||||
\penalty-500
|
||||
\fi
|
||||
|
||||
% hyperref anchor
|
||||
\hrefanchor
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\sectionprefix\thesectioncount.\thesubsectioncount.\thesubsubsectioncount}
|
||||
|
||||
% get widths
|
||||
\def\@secnum{{\bf\hskip1.cm\sectionprefix\thesectioncount.\thesubsectioncount.\thesubsubsectioncount.\hskip5pt}}
|
||||
\settowidth\secnumwidth{\@secnum}
|
||||
\setlength\sectitlewidth\textwidth
|
||||
\addtolength\sectitlewidth{-\secnumwidth}
|
||||
% print name
|
||||
\parbox{\textwidth}{
|
||||
\@secnum
|
||||
\parbox[t]{\sectitlewidth}{\large\bf #1}}
|
||||
|
||||
% write to table of contents
|
||||
\iftoc
|
||||
% save lncount in aux variable which is written to toc
|
||||
\immediate\write\tocoutput{\noexpand\expandafter\noexpand\edef\noexpand\csname toc@subsubsec.\thesectioncount.\thesubsectioncount.\thesubsubsectioncount\endcsname{\thelncount}}
|
||||
\write\tocoutput{\noexpand\tocsubsubsection{#1}{\thepage}}
|
||||
\fi
|
||||
|
||||
% space
|
||||
\par\penalty10000
|
||||
\medskip\penalty10000
|
||||
}
|
||||
|
||||
%% itemize
|
||||
\newlength\itemizeskip
|
||||
% left margin for items
|
||||
\setlength\itemizeskip{20pt}
|
||||
\newlength\itemizeseparator
|
||||
% space between the item symbol and the text
|
||||
\setlength\itemizeseparator{5pt}
|
||||
% penalty preceding an itemize
|
||||
\newcount\itemizepenalty
|
||||
\itemizepenalty=0
|
||||
% counter counting the itemize level
|
||||
\newcounter{itemizecount}
|
||||
|
||||
% item symbol
|
||||
\def\itemizept#1{
|
||||
\ifnum#1=1
|
||||
\textbullet
|
||||
\else
|
||||
$\scriptstyle\blacktriangleright$
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
\newlength\current@itemizeskip
|
||||
\setlength\current@itemizeskip{0pt}
|
||||
\def\itemize{%
|
||||
\par\expandafter\penalty\the\itemizepenalty\medskip\expandafter\penalty\the\itemizepenalty%
|
||||
\addtocounter{itemizecount}{1}%
|
||||
\addtolength\current@itemizeskip{\itemizeskip}%
|
||||
\leftskip\current@itemizeskip%
|
||||
}
|
||||
\def\enditemize{%
|
||||
\addtocounter{itemizecount}{-1}%
|
||||
\addtolength\current@itemizeskip{-\itemizeskip}%
|
||||
\par\expandafter\penalty\the\itemizepenalty\leftskip\current@itemizeskip%
|
||||
\medskip\expandafter\penalty\the\itemizepenalty%
|
||||
}
|
||||
\newlength\itempt@total
|
||||
\def\item{
|
||||
\settowidth\itempt@total{\itemizept\theitemizecount}
|
||||
\addtolength\itempt@total{\itemizeseparator}
|
||||
\par
|
||||
\medskip
|
||||
\hskip-\itempt@total\itemizept\theitemizecount\hskip\itemizeseparator
|
||||
}
|
||||
|
||||
|
||||
%% prevent page breaks after itemize
|
||||
\newcount\previtemizepenalty
|
||||
\def\nopagebreakafteritemize{
|
||||
\previtemizepenalty=\itemizepenalty
|
||||
\itemizepenalty=10000
|
||||
}
|
||||
%% back to previous value
|
||||
\def\restorepagebreakafteritemize{
|
||||
\itemizepenalty=\previtemizepenalty
|
||||
}
|
||||
|
||||
%% enumerate
|
||||
\newcounter{enumerate@count}
|
||||
\def\enumerate{
|
||||
\setcounter{enumerate@count}0
|
||||
\let\olditem\item
|
||||
\let\olditemizept\itemizept
|
||||
\def\item{
|
||||
% counter
|
||||
\stepcounter{enumerate@count}
|
||||
% set header
|
||||
\def\itemizept{\theenumerate@count.}
|
||||
% hyperref anchor
|
||||
\hrefanchor
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\theenumerate@count}
|
||||
\olditem
|
||||
}
|
||||
\itemize
|
||||
}
|
||||
\def\endenumerate{
|
||||
\enditemize
|
||||
\let\item\olditem
|
||||
\let\itemizept\olditemizept
|
||||
}
|
||||
|
||||
|
||||
%% equation numbering
|
||||
% counter
|
||||
\newcounter{seqcount}
|
||||
% booleans (write section or subsection in equation number)
|
||||
\newif\ifsectionsineq
|
||||
\newif\ifsubsectionsineq
|
||||
\def\seqcount{
|
||||
\stepcounter{seqcount}
|
||||
% the output
|
||||
\edef\seqformat{\theseqcount}
|
||||
% add subsection number
|
||||
\ifsubsectionsineq
|
||||
\let\tmp\seqformat
|
||||
\edef\seqformat{\thesubsectioncount.\tmp}
|
||||
\fi
|
||||
% add section number
|
||||
\ifsectionsineq
|
||||
\let\tmp\seqformat
|
||||
\edef\seqformat{\sectionprefix\thesectioncount.\tmp}
|
||||
\fi
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\seqformat}
|
||||
% write number
|
||||
\marginnote{\hfill(\seqformat)}
|
||||
}
|
||||
%% equation environment compatibility
|
||||
\def\equation{\hrefanchor$$\seqcount}
|
||||
\def\endequation{$$\@ignoretrue}
|
||||
|
||||
|
||||
%% figures
|
||||
% counter
|
||||
\newcounter{figcount}
|
||||
% booleans (write section or subsection in equation number)
|
||||
\newif\ifsectionsinfig
|
||||
\newif\ifsubsectionsinfig
|
||||
% width of figures
|
||||
\newlength\figwidth
|
||||
\setlength\figwidth\textwidth
|
||||
\addtolength\figwidth{-2.5cm}
|
||||
% caption
|
||||
\def\defcaption{
|
||||
\long\def\caption##1{
|
||||
\stepcounter{figcount}
|
||||
|
||||
% hyperref anchor
|
||||
\hrefanchor
|
||||
|
||||
% the number of the figure
|
||||
\edef\figformat{\thefigcount}
|
||||
% add subsection number
|
||||
\ifsubsectionsinfig
|
||||
\let\tmp\figformat
|
||||
\edef\figformat{\thesubsectioncount.\tmp}
|
||||
\fi
|
||||
% add section number
|
||||
\ifsectionsinfig
|
||||
\let\tmp\figformat
|
||||
\edef\figformat{\sectionprefix\thesectioncount.\tmp}
|
||||
\fi
|
||||
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\figformat}
|
||||
|
||||
% write
|
||||
\hfil fig \figformat: \parbox[t]{\figwidth}{\leavevmode\small##1}
|
||||
|
||||
% space
|
||||
\par\bigskip
|
||||
}
|
||||
}
|
||||
%% short caption: centered
|
||||
\def\captionshort#1{
|
||||
\stepcounter{figcount}
|
||||
|
||||
% hyperref anchor
|
||||
\hrefanchor
|
||||
|
||||
% the number of the figure
|
||||
\edef\figformat{\thefigcount}
|
||||
% add section number
|
||||
\ifsectionsinfig
|
||||
\let\tmp\figformat
|
||||
\edef\figformat{\sectionprefix\thesectioncount.\tmp}
|
||||
\fi
|
||||
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\figformat}
|
||||
|
||||
% write
|
||||
\hfil fig \figformat: {\small#1}
|
||||
|
||||
%space
|
||||
\par\bigskip
|
||||
}
|
||||
|
||||
%% environment
|
||||
\def\figure{
|
||||
\par
|
||||
\vfil\penalty100\vfilneg
|
||||
\bigskip
|
||||
}
|
||||
\def\endfigure{
|
||||
\par
|
||||
\vfil\penalty100\vfilneg
|
||||
\bigskip
|
||||
}
|
||||
|
||||
|
||||
%% start appendices
|
||||
\def\appendix{
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
% counter
|
||||
\setcounter{sectioncount}0
|
||||
|
||||
% prefix
|
||||
\def\sectionprefix{A}
|
||||
|
||||
% write
|
||||
{\bf \LARGE Appendices}\par\penalty10000\bigskip\penalty10000
|
||||
|
||||
% add a mention in the table of contents
|
||||
\iftoc
|
||||
\immediate\write\tocoutput{\noexpand\tocappendices}\penalty10000
|
||||
\fi
|
||||
|
||||
%% uncomment for new page for each appendix
|
||||
%\def\seqskip{\vfill\pagebreak}
|
||||
}
|
||||
|
||||
|
||||
%% bibliography
|
||||
% size of header
|
||||
\newlength\bibheader
|
||||
\def\thebibliography#1{
|
||||
\hrefanchor
|
||||
|
||||
% add a mention in the table of contents
|
||||
\iftoc
|
||||
% save lncount in aux variable which is written to toc
|
||||
\immediate\write\tocoutput{\noexpand\expandafter\noexpand\edef\noexpand\csname toc@references\endcsname{\thelncount}}
|
||||
\write\tocoutput{\noexpand\tocreferences{\thepage}}\penalty10000
|
||||
\fi
|
||||
|
||||
% write
|
||||
{\bf \LARGE References}\par\penalty10000\bigskip\penalty10000
|
||||
% width of header
|
||||
\settowidth\bibheader{[#1]}
|
||||
\leftskip\bibheader
|
||||
}
|
||||
% end environment
|
||||
\def\endthebibliography{
|
||||
\par\leftskip0pt
|
||||
}
|
||||
|
||||
%% bibitem command
|
||||
\def\bibitem[#1]#2{%
|
||||
\hrefanchor%
|
||||
\outdef{label@cite#2}{#1}%
|
||||
\hskip-\bibheader%
|
||||
\makebox[\bibheader]{\cite{#2}\hfill}%
|
||||
}
|
||||
|
||||
%% cite command (adapted from latex.ltx)
|
||||
% @tempswa is set to true when there is an optional argument
|
||||
\newif\@tempswa
|
||||
\def\cite{%
|
||||
% check whether there is an optional argument (if there is none, add on empty '[]')
|
||||
\@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}%
|
||||
}
|
||||
% command with optional argument
|
||||
\def\@citex[#1]#2{\leavevmode%
|
||||
% initialize loop
|
||||
\let\@citea\@empty%
|
||||
% format
|
||||
\@cite{%
|
||||
% loop over ',' separated list
|
||||
\@for\@citeb:=#2\do{%
|
||||
% text to add at each iteration of the loop (separator between citations)
|
||||
\@citea\def\@citea{,\ }%
|
||||
% add entry to citelist
|
||||
\@writecitation{\@citeb}%
|
||||
\ref{cite\@citeb}%
|
||||
}%
|
||||
}%
|
||||
% add optional argument text (as an argument to '\@cite')
|
||||
{#1}%
|
||||
}
|
||||
\def\@cite#1#2{%
|
||||
[#1\if@tempswa , #2\fi]%
|
||||
}
|
||||
%% add entry to citelist after checking it has not already been added
|
||||
\def\@writecitation#1{%
|
||||
\ifcsname if#1cited\endcsname%
|
||||
\else%
|
||||
\expandafter\newif\csname if#1cited\endcsname%
|
||||
\immediate\write\@auxout{\string\citation{#1}}%
|
||||
\fi%
|
||||
}
|
||||
|
||||
%% table of contents
|
||||
% boolean
|
||||
\newif\iftoc
|
||||
\def\tableofcontents{
|
||||
{\bf \large Table of contents:}\par\penalty10000\bigskip\penalty10000
|
||||
|
||||
% copy content from file
|
||||
\IfFileExists{\jobname.toc}{\input{\jobname.toc}}{{\tt error: table of contents missing}}
|
||||
|
||||
% open new toc
|
||||
\newwrite\tocoutput
|
||||
\immediate\openout\tocoutput=\jobname.toc
|
||||
|
||||
\toctrue
|
||||
}
|
||||
%% close file
|
||||
\AtEndDocument{
|
||||
% close toc
|
||||
\iftoc
|
||||
\immediate\closeout\tocoutput
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
%% fill line with dots
|
||||
\def\leaderfill{\leaders\hbox to 1em {\hss. \hss}\hfill}
|
||||
|
||||
%% same as sectionprefix
|
||||
\def\tocsectionprefix{}
|
||||
|
||||
%% toc formats
|
||||
\newcounter{tocsectioncount}
|
||||
\def\tocsection #1#2{
|
||||
\stepcounter{tocsectioncount}
|
||||
\setcounter{tocsubsectioncount}{0}
|
||||
\setcounter{tocsubsubsectioncount}{0}
|
||||
% write
|
||||
\smallskip\hyperlink{ln.\csname toc@sec.\thetocsectioncount\endcsname}{{\bf \tocsectionprefix\thetocsectioncount}.\hskip5pt {\color{blue}#1}\leaderfill#2}\par
|
||||
}
|
||||
\newcounter{tocsubsectioncount}
|
||||
\def\tocsubsection #1#2{
|
||||
\stepcounter{tocsubsectioncount}
|
||||
\setcounter{tocsubsubsectioncount}{0}
|
||||
% write
|
||||
{\hskip10pt\hyperlink{ln.\csname toc@subsec.\thetocsectioncount.\thetocsubsectioncount\endcsname}{{\bf \thetocsubsectioncount}.\hskip5pt {\color{blue}\small #1}\leaderfill#2}}\par
|
||||
}
|
||||
\newcounter{tocsubsubsectioncount}
|
||||
\def\tocsubsubsection #1#2{
|
||||
\stepcounter{tocsubsubsectioncount}
|
||||
% write
|
||||
{\hskip20pt\hyperlink{ln.\csname toc@subsubsec.\thetocsectioncount.\thetocsubsectioncount.\thetocsubsubsectioncount\endcsname}{{\bf \thetocsubsubsectioncount}.\hskip5pt {\color{blue}\small #1}\leaderfill#2}}\par
|
||||
}
|
||||
\def\tocappendices{
|
||||
\medskip
|
||||
\setcounter{tocsectioncount}0
|
||||
{\bf Appendices}\par
|
||||
\smallskip
|
||||
\def\tocsectionprefix{A}
|
||||
}
|
||||
\def\tocreferences#1{
|
||||
\medskip
|
||||
{\hyperlink{ln.\csname toc@references\endcsname}{{\color{blue}\bf References}\leaderfill#1}}\par
|
||||
\smallskip
|
||||
}
|
||||
|
||||
|
||||
%% definitions that must be loaded at begin document
|
||||
\let\ian@olddocument\document
|
||||
\def\document{
|
||||
\ian@olddocument
|
||||
|
||||
\deflabel
|
||||
\defcaption
|
||||
}
|
||||
|
||||
%% end
|
||||
\ian@defaultoptions
|
||||
\endinput
|
162
libs/iantheo.sty
Normal file
162
libs/iantheo.sty
Normal file
@ -0,0 +1,162 @@
|
||||
%%
|
||||
%% iantheorem package:
|
||||
%% Ian's customized theorem command
|
||||
%%
|
||||
|
||||
%% boolean to signal that this package was loaded
|
||||
\newif\ifiantheo
|
||||
|
||||
%% TeX format
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
|
||||
%% package name
|
||||
\ProvidesPackage{iantheo}[2016/11/10]
|
||||
|
||||
%% options
|
||||
\newif\ifsectionintheo
|
||||
\DeclareOption{section_in_theo}{\sectionintheotrue}
|
||||
\DeclareOption{no_section_in_theo}{\sectionintheofalse}
|
||||
\newif\ifsubsectionintheo
|
||||
\DeclareOption{subsection_in_theo}{\subsectionintheotrue}
|
||||
\DeclareOption{no_subsection_in_theo}{\subsectionintheofalse}
|
||||
|
||||
\def\iantheo@defaultoptions{
|
||||
\ExecuteOptions{section_in_theo, no_subsection_in_theo}
|
||||
\ProcessOptions
|
||||
|
||||
%%% reset at every new section
|
||||
\ifsectionintheo
|
||||
\let\iantheo@oldsection\section
|
||||
\gdef\section{\setcounter{theocount}{0}\iantheo@oldsection}
|
||||
\fi
|
||||
|
||||
%% reset at every new subsection
|
||||
\ifsubsectionintheo
|
||||
\let\iantheo@oldsubsection\subsection
|
||||
\gdef\subsection{\setcounter{theocount}{0}\iantheo@oldsubsection}
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
%% delimiters
|
||||
\def\delimtitle#1{
|
||||
\par%
|
||||
\leavevmode%
|
||||
\raise.3em\hbox to\hsize{%
|
||||
\lower0.3em\hbox{\vrule height0.3em}%
|
||||
\hrulefill%
|
||||
\ \lower.3em\hbox{#1}\ %
|
||||
\hrulefill%
|
||||
\lower0.3em\hbox{\vrule height0.3em}%
|
||||
}%
|
||||
\par\penalty10000%
|
||||
}
|
||||
|
||||
%% callable by ref
|
||||
\def\delimtitleref#1{
|
||||
\par%
|
||||
%
|
||||
\ifdefined\ianclass%
|
||||
% hyperref anchor%
|
||||
\hrefanchor%
|
||||
% define tag (for \label)%
|
||||
\xdef\tag{#1}%
|
||||
\fi%
|
||||
%
|
||||
\leavevmode%
|
||||
\raise.3em\hbox to\hsize{%
|
||||
\lower0.3em\hbox{\vrule height0.3em}%
|
||||
\hrulefill%
|
||||
\ \lower.3em\hbox{\bf #1}\ %
|
||||
\hrulefill%
|
||||
\lower0.3em\hbox{\vrule height0.3em}%
|
||||
}%
|
||||
\par\penalty10000%
|
||||
}
|
||||
|
||||
%% no title
|
||||
\def\delim{
|
||||
\par%
|
||||
\leavevmode\raise.3em\hbox to\hsize{%
|
||||
\lower0.3em\hbox{\vrule height0.3em}%
|
||||
\hrulefill%
|
||||
\lower0.3em\hbox{\vrule height0.3em}%
|
||||
}%
|
||||
\par\penalty10000%
|
||||
}
|
||||
|
||||
%% end delim
|
||||
\def\enddelim{
|
||||
\par\penalty10000%
|
||||
\leavevmode%
|
||||
\raise.3em\hbox to\hsize{%
|
||||
\vrule height0.3em\hrulefill\vrule height0.3em%
|
||||
}%
|
||||
\par%
|
||||
}
|
||||
|
||||
|
||||
%% theorem
|
||||
% counter
|
||||
\newcounter{theocount}
|
||||
% booleans (write section or subsection in equation number)
|
||||
\def\theo#1{
|
||||
\stepcounter{theocount}
|
||||
\ifdefined\ianclass
|
||||
% hyperref anchor
|
||||
\hrefanchor
|
||||
\fi
|
||||
% the number
|
||||
\def\formattheo{\thetheocount}
|
||||
% add subsection number
|
||||
\ifsubsectionintheo
|
||||
\let\tmp\formattheo
|
||||
\edef\formattheo{\thesubsectioncount.\tmp}
|
||||
\fi
|
||||
% add section number
|
||||
\ifsectionintheo
|
||||
\let\tmp\formattheo
|
||||
\edef\formattheo{\sectionprefix\thesectioncount.\tmp}
|
||||
\fi
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\formattheo}
|
||||
% write
|
||||
\delimtitle{\bf #1 \formattheo}
|
||||
}
|
||||
\let\endtheo\enddelim
|
||||
%% theorem headers with name
|
||||
\def\theoname#1#2{
|
||||
\theo{#1}\hfil({\it #2})\par\penalty10000\medskip%
|
||||
}
|
||||
|
||||
|
||||
%% qed symbol
|
||||
\def\qedsymbol{$\square$}
|
||||
\def\qed{\penalty10000\hfill\penalty10000\qedsymbol}
|
||||
|
||||
|
||||
%% compatibility with article class
|
||||
\ifdefined\ianclasstrue
|
||||
\relax
|
||||
\else
|
||||
\def\thesectioncount{\thesection}
|
||||
\def\thesubsectioncount{\thesubsection}
|
||||
\def\sectionprefix{}
|
||||
\fi
|
||||
|
||||
|
||||
%% prevent page breaks after displayed equations
|
||||
\newcount\prevpostdisplaypenalty
|
||||
\def\nopagebreakaftereq{
|
||||
\prevpostdisplaypenalty=\postdisplaypenalty
|
||||
\postdisplaypenalty=10000
|
||||
}
|
||||
%% back to previous value
|
||||
\def\restorepagebreakaftereq{
|
||||
\postdisplaypenalty=\prevpostdisplaypenalty
|
||||
}
|
||||
|
||||
|
||||
%% end
|
||||
\iantheo@defaultoptions
|
||||
\endinput
|
106
libs/point.sty
Normal file
106
libs/point.sty
Normal file
@ -0,0 +1,106 @@
|
||||
%%
|
||||
%% Points package:
|
||||
%% \point commands
|
||||
%%
|
||||
|
||||
%% TeX format
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
|
||||
%% package name
|
||||
\ProvidesPackage{point}[2017/06/13]
|
||||
|
||||
%% options
|
||||
\newif\ifresetatsection
|
||||
\DeclareOption{reset_at_section}{\resetatsectiontrue}
|
||||
\DeclareOption{no_reset_at_section}{\resetatsectionfalse}
|
||||
\newif\ifresetatsubsection
|
||||
\DeclareOption{reset_at_subsection}{\resetatsubsectiontrue}
|
||||
\DeclareOption{no_reset_at_subsection}{\resetatsubsectionfalse}
|
||||
\newif\ifresetattheo
|
||||
\DeclareOption{reset_at_theo}{\resetattheotrue}
|
||||
\DeclareOption{no_reset_at_theo}{\resetattheofalse}
|
||||
|
||||
\def\point@defaultoptions{
|
||||
\ExecuteOptions{reset_at_section, reset_at_subsection, no_reset_at_theo}
|
||||
\ProcessOptions
|
||||
|
||||
%% reset at every new section
|
||||
\ifresetatsection
|
||||
\let\point@oldsection\section
|
||||
\gdef\section{\resetpointcounter\point@oldsection}
|
||||
\fi
|
||||
%% reset at every new subsection
|
||||
\ifresetatsubsection
|
||||
\let\point@oldsubsection\subsection
|
||||
\gdef\subsection{\resetpointcounter\point@oldsubsection}
|
||||
\fi
|
||||
|
||||
%% reset at every new theorem
|
||||
\ifresetattheo
|
||||
\ifdefined\iantheotrue
|
||||
\let\point@oldtheo\theo
|
||||
\gdef\theo{\resetpointcounter\point@oldtheo}
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
%% point
|
||||
% counter
|
||||
\newcounter{pointcount}
|
||||
\def\point{
|
||||
\stepcounter{pointcount}
|
||||
\setcounter{subpointcount}{0}
|
||||
% hyperref anchor (only if the class is 'ian')
|
||||
\ifdefined\ifianclass
|
||||
\hrefanchor
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\thepointcount}
|
||||
\fi
|
||||
% header
|
||||
\indent{\bf \thepointcount\ - }
|
||||
}
|
||||
|
||||
%% subpoint
|
||||
% counter
|
||||
\newcounter{subpointcount}
|
||||
\def\subpoint{
|
||||
\stepcounter{subpointcount}
|
||||
\setcounter{subsubpointcount}0
|
||||
% hyperref anchor (only if the class is 'ian')
|
||||
\ifdefined\ifianclass
|
||||
\hrefanchor
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\thepointcount-\thesubpointcount}
|
||||
\fi
|
||||
% header
|
||||
\indent\hskip.5cm{\bf \thepointcount-\thesubpointcount\ - }
|
||||
}
|
||||
|
||||
%% subsubpoint
|
||||
% counter
|
||||
\newcounter{subsubpointcount}
|
||||
\def\subsubpoint{
|
||||
\stepcounter{subsubpointcount}
|
||||
% hyperref anchor (only if the class is 'ian')
|
||||
\ifdefined\ifianclass
|
||||
\hrefanchor
|
||||
% define tag (for \label)
|
||||
\xdef\tag{\thepointcount-\thesubpointcount-\thesubsubpointcount}
|
||||
\fi
|
||||
\indent\hskip1cm{\bf \thepointcount-\thesubpointcount-\thesubsubpointcount\ - }
|
||||
}
|
||||
|
||||
|
||||
%% reset point counters
|
||||
\def\resetpointcounter{
|
||||
\setcounter{pointcount}{0}
|
||||
\setcounter{subpointcount}{0}
|
||||
\setcounter{subsubpointcount}{0}
|
||||
}
|
||||
|
||||
|
||||
|
||||
%% end
|
||||
\point@defaultoptions
|
||||
\endinput
|
Loading…
Reference in New Issue
Block a user