diff --git a/tex/bare_conf.tex b/tex/bare_conf.tex index 27afde1..3acb2fa 100755 --- a/tex/bare_conf.tex +++ b/tex/bare_conf.tex @@ -1,77 +1,47 @@ +\documentclass[acmlarge]{acmart} -%% bare_conf.tex -%% V1.4b -%% 2015/08/26 -%% by Michael Shell -%% See: -%% http://www.michaelshell.org/ -%% for current contact information. -%% -%% This is a skeleton file demonstrating the use of IEEEtran.cls -%% (requires IEEEtran.cls version 1.8b or later) with an IEEE -%% conference paper. -%% -%% Support sites: -%% http://www.michaelshell.org/tex/ieeetran/ -%% http://www.ctan.org/pkg/ieeetran -%% and -%% http://www.ieee.org/ +\usepackage{booktabs} % For formal tables -%%************************************************************************* -%% Legal Notice: -%% This code is offered as-is without any warranty either expressed or -%% implied; without even the implied warranty of MERCHANTABILITY or -%% FITNESS FOR A PARTICULAR PURPOSE! -%% User assumes all risk. -%% In no event shall the IEEE or any contributor to this code be liable for -%% any damages or losses, including, but not limited to, incidental, -%% consequential, or any other damages, resulting from the use or misuse -%% of any information contained here. -%% -%% All comments are the opinions of their respective authors and are not -%% necessarily endorsed by the IEEE. -%% -%% This work is distributed under the LaTeX Project Public License (LPPL) -%% ( http://www.latex-project.org/ ) version 1.3, and may be freely used, -%% distributed and modified. A copy of the LPPL, version 1.3, is included -%% in the base LaTeX documentation of all distributions of LaTeX released -%% 2003/12/01 or later. -%% Retain all contribution notices and credits. -%% ** Modified files should be clearly indicated as such, including ** -%% ** renaming them and changing author support contact information. ** -%%************************************************************************* +\usepackage[ruled]{algorithm2e} % For algorithms +\renewcommand{\algorithmcfname}{ALGORITHM} +\SetAlFnt{\small} +\SetAlCapFnt{\small} +\SetAlCapNameFnt{\small} +\SetAlCapHSkip{0pt} +\IncMargin{-\parindent} +% Metadata Information +\acmJournal{IMWUT} +\acmVolume{0} +\acmNumber{0} +\acmArticle{0} +\acmYear{2017} +\acmMonth{0} +\acmArticleSeq{0} -% *** Authors should verify (and, if needed, correct) their LaTeX system *** -% *** with the testflow diagnostic prior to trusting their LaTeX platform *** -% *** with production work. The IEEE's font choices and paper sizes can *** -% *** trigger bugs that do not appear when using other class files. *** *** -% The testflow support page is at: -% http://www.michaelshell.org/tex/testflow/ +% Copyright +\setcopyright{acmcopyright} +%\setcopyright{acmlicensed} +%\setcopyright{rightsretained} +%\setcopyright{usgov} +%\setcopyright{usgovmixed} +%\setcopyright{cagov} +%\setcopyright{cagovmixed} +% DOI +\acmDOI{0000001.0000001} +% Paper history +\received{dummy} +\received[accepted]{dummy} -\documentclass[conference]{IEEEtran} -% Some Computer Society conferences also require the compsoc mode option, -% but others use the standard conference format. -% -% If IEEEtran.cls has not been installed into the LaTeX system files, -% manually specify the path to it like: -% \documentclass[conference]{../sty/IEEEtran} - - -% needed packages \usepackage{color, colortbl} -%\usepackage[table]{xcolor} -\usepackage{cite} +%\usepackage{cite} \usepackage{graphicx} -\usepackage{amsfonts} -\usepackage[cmex10]{amsmath} \interdisplaylinepenalty=2500 -\usepackage{algorithmic} \usepackage{array} \usepackage{mdwmath} \usepackage{mdwtab} @@ -132,54 +102,38 @@ \begin{document} -% -% paper title -% Titles are generally capitalized except for words such as a, an, and, as, -% at, but, by, for, in, nor, of, on, or, the, to and up, which are usually -% not capitalized unless they are the first or last word of the title. -% Linebreaks \\ can be used within to get better formatting as desired. -% Do not put math or special symbols in the title. -\title{\docWIFI{} Optimization for Smartphone-based Indoor Localization} + \title{\docWIFI{} Optimization for Smartphone-based Indoor Localization??} -% author names and affiliations -% use a multiple column layout for up to three different -% affiliations -\author{ - - \IEEEauthorblockN{Frank Ebner, Toni Fetzer and Frank Deinzer}% - \IEEEauthorblockA{% - Faculty of Computer Science and Business Information Systems\\ - University of Applied Sciences W\"urzburg-Schweinfurt\\ - W\"urzburg, Germany\\ - \{frank.ebner, toni.fetzer, frank.deinzer\}@fhws.de\\ + \author{Frank Ebner} + \author{Toni Fetzer} + \author{Frank Deinzer} + \affiliation{% + \institution{University of Applied Sciences W\"urzburg-Schweinfurt} + \department{Faculty of Computer Science and Business Information Systems} + \city{W\"urzburg} + %\state{VA} + %\postcode{22903} + \country{Germany} } - \and + + \author{Marcin Grzegorzek} + \affiliation{% + \institution{University of Siegen} + \department{Pattern Recognition Group} + \city{Siegen} + %\state{VA} + %\postcode{22903} + \country{Germany} + } + + - \IEEEauthorblockN{Marcin Grzegorzek} - \IEEEauthorblockA{% - Pattern Recognition Group \\ - University of Siegen\\ - Siegen, Germany\\ - \{marcin.grzegorzek\}@uni-siegen.de - }% -} + \input{chapters/abstract} -% conference papers do not typically use \thanks and this command -% is locked out in conference mode. If really needed, such as for -% the acknowledgment of grants, issue a \IEEEoverridecommandlockouts -% after \documentclass - -% use for special paper notices -%\IEEEspecialpapernotice{(Invited Paper)} + \maketitle -% make the title area -\maketitle - -% As a general rule, do not put math, special symbols or citations -% in the abstract -\input{chapters/abstract} % For peer review papers, you can put extra information on the cover @@ -190,7 +144,7 @@ % % For peerreview papers, this IEEEtran command inserts a page break and % creates the second title. It will be ignored for other modes. -\IEEEpeerreviewmaketitle +%\IEEEpeerreviewmaketitle \input{chapters/introduction} @@ -220,8 +174,11 @@ % references section -\bibliographystyle{IEEEtran} -\bibliography{IEEEabrv,egbib} +%\bibliographystyle{IEEEtran} +%\bibliography{IEEEabrv,egbib} + +\bibliographystyle{ACM-Reference-Format} +\bibliography{egbib} \end{document} diff --git a/tex/chapters/abstract.tex b/tex/chapters/abstract.tex index 23289a5..dd2e9f6 100755 --- a/tex/chapters/abstract.tex +++ b/tex/chapters/abstract.tex @@ -1,12 +1,58 @@ -abstract -system setup kostet oft sehr viel zeit [fingerprinting kostet] -deshalb werden alternativen untersucht: -bekannte AP position mit empirischen parametern -und optimierung durch einige referenzmessungen +\begin{abstract} -floorplan wird für die navigation bzw orientierung des anwenders eh gebraucht -dann kann man ihn auch gleich für ein bewegungsmodell nutzen + Indoor localization and indoor pedestrian navigation is an active field of research + with increasing attention. + % + As of today, many systems will run on commodity smartphones but most of them still rely on + fingerprinting, which demands for high setup- and maintenance-times. + Alternatives, such as simple signal strength prediction models, provide fast setup times, + but often do not provide the accuracy required for use-cases like indoor navigation or + location-based services. + % + While more complex models provide an increased accuracy by including architectural knowledge + about walls and other obstacles, they often require additional computation during runtime and + demand for prior knowledge during setup. + + Within this work we will thus focus on simple, easy to set-up models and evaluate their + performance compared to real-world measurements. The evaluation ranges from a fully empiric, instant + setup, given the transmitter locations are well-known, to a highly optimized scenario based + on some reference measurements within the building. Furthermore, we will propose a new + signal strength prediction model as a combination of several simple ones. This tradeoff + increases accuracy with only minor additional computations. + % + All of the optimized models are evaluated within an actual smartphone-based + indoor localization system. This system uses the phone's \docWIFI{}, barometer and IMU + to infer the pedestrian's current location via recursive density estimation based on particle filtering. + + We will show that while a \SI{100}{\percent} empiric parameter choice for the model already provides enough + accuracy for many use-cases, a small number of reference measurements is enough to dramatically increase + such a system's performance. + + + + -es sollte klar werden, dass es auch darum geht, effizient -auf einem normalen smartphone lauffähig zu sein [passend zum journal] + %system setup kostet oft sehr viel zeit [fingerprinting kostet] + %deshalb werden alternativen untersucht: + %bekannte AP position mit empirischen parametern + %und optimierung durch einige referenzmessungen + %floorplan wird für die navigation bzw orientierung des anwenders eh gebraucht + %dann kann man ihn auch gleich für ein bewegungsmodell nutzen + + %es sollte klar werden, dass es auch darum geht, effizient + %auf einem normalen smartphone lauffähig zu sein [passend zum journal] + +\end{abstract} + +% TODO +\begin{CCSXML} + +\end{CCSXML} + +%\ccsdesc[500]{Computer systems organization~Embedded systems} +%\ccsdesc[300]{Computer systems organization~Redundancy} +%\ccsdesc{Computer systems organization~Robotics} +%s\ccsdesc[100]{Networks~Network reliability} + +\keywords{\docWIFI{}, indoor localization, sensor fusion} diff --git a/tex/chapters/introduction.tex b/tex/chapters/introduction.tex index d345a37..f418f5c 100755 --- a/tex/chapters/introduction.tex +++ b/tex/chapters/introduction.tex @@ -1,7 +1,7 @@ \section{Introduction} State of the art indoor localization systems use a fusion of multiple - (Smartphone) sensors to infer the pedestrian's current location within a building + (smartphone) sensors to infer the pedestrian's current location within a building based on a variety of sensor observations. % Among those, the internal IMU, namely accelerometer and gyroscope, is often @@ -11,29 +11,29 @@ entering the building. Additionally, the sensor's error will sum up over time. - Depending on the used sensor fusion method, the latter can be addressed, + Depending on the used fusion-method, the latter can be addressed, using a movement model for the pedestrian, that prevents unlikely movements and locations. However, this will obviously work only to some extent and still requires the initial position to be at least vaguely known. % Thus, indoor localization systems incorporate the knowledge of sensors, - that provide absolute location information like \docWIFI{} and + that provide absolute location information, like \docWIFI{} and \docIBeacon{}s. The signal strength of nearby transmitters, received by the smartphone, yields a vague information about the distance - to each transmitter. While the provided accuracy is relatively low, + towards it. While the provided accuracy is relatively low, it can be stabilized by the IMU and vice versa. - The downside of such an approach: both sensors require additional prior + The downside of such an approach: both, \docWIFI{} and \docIBeacon{}s, require additional prior knowledge to work: To infer the probability of the pedestrian currently residing at an arbitrary location, one compares the signal strengths received by the smartphone with the signal strengths one should receive at this - location (prior knowledge). As \docWIFI{} signals are highly dependent + location (prior knowledge). As RF-signals are highly dependent on the surroundings, those values can change rapidly within meters. % - That is why fingerprinting became popular: The required prior knowledge + That is why fingerprinting became popular, where the required prior knowledge is gathered by manually scanning each location within the building e.g. - using cells with size of \SI{2}{\meter}. While this provides the highest + using cells with \SI{2}{\meter} in size. While this provides the highest possible accuracy due to actual measurements of the real situation, one can easily realize the necessary amount of work for both, the initial setup and maintenance when transmitters are changed or renovations take @@ -48,35 +48,39 @@ %advanced models additionally include the floorplan within their prediction. Obviously, simple models will represent the real signal strengths only to some extent, as not all ambient conditions, such as walls, are considered. - Furthermore, the choice of the model's parameters depends on the actual setup - and parameters that work within building A might not work out within building B. + Furthermore, the choice of the model's parameters depends on the actual architecture and \docWIFI{} setup: + Parameters that work within building A might not work out within building B. - Thus, a compromise comes to mind, that a few reference measurements used - for a viable model setup might be a valid tradeoff between accuracy and - setup time. + Thus, a compromise comes to mind: Instead of using hundreds of fingerprints, + a few reference measurements used for a model setup might be a valid tradeoff + between resulting accuracy and necessary setup time. Within this work we will focus on simple signal strength prediction models that do not incorporate knowledge of nearby walls, but can be used - for real-time applications on commodity smartphones. The to-be-expected accuracy - of those models is analyzed for various setups ranging from just empirical - parameters (no setup time when transmitter positions are known) to optimized - parameters where no prior knowledge is necessary and a few reference measurements - suffice. + for real-time applications on commodity smartphones. + % + To mitigate the issues of those signal strength predictors, we propose a new model + that is a combination of several simple ones. It is more accurate, requires only minor + additional computations and thus is well suited for use in mobile applications. + % + The to-be-expected accuracy (in \decibel{} and \meter{}) of all models is analyzed for various setups ranging from + just empirical parameters (no setup time when transmitter positions are known) to optimized + parameters, where no prior knowledge is necessary and a few reference measurements suffice. Despite analyzing the \docWIFI{} performance on its own, we will also have - a closer look at the to-be-expected performance within a complete indoor - localization setup using a floorplan-based movement model together with - various sensors via recursive state estimation based on a particle filter. + a closer look at the resulting performance-changes within a fully featured smartphone-based + indoor localization system using a movement model based on the building's floorplan, + together with various other sensors and recursive state estimation based on a particle filter. - \todo{ - fokus:\\ - - wlan parameter + optimierung\\ - - evaluation der einzel und gesamtergebnisse - } + %\todo{ + %fokus:\\ + %- wlan parameter + optimierung\\ + %- evaluation der einzel und gesamtergebnisse + %} - \todo{ - contribution?:\\ - - neues wifi modell,\\ - - neues resampling,\\ - - model param optimierung + eval was es bringt - } + %\todo{ + %contribution?:\\ + %- neues wifi modell,\\ + %- neues resampling,\\ + %- model param optimierung + eval was es bringt + %} diff --git a/tex/chapters/relatedwork.tex b/tex/chapters/relatedwork.tex index bcca9e5..45eb1f4 100755 --- a/tex/chapters/relatedwork.tex +++ b/tex/chapters/relatedwork.tex @@ -1,51 +1,58 @@ \section{Related Work} - Indoor localization based on \docWIFI{} signal strengths dates back to the year - 2000 and the work of Bahl and Padmanabhan \cite{radar}. During an offline-phase, a - multitude of reference measurements are conducted once. Those measurements are compared - against live readings during an online-phase. The pedestrian's location is inferred - using the $k$-nearest neighbor(s) based on the Euclidean distance between currently - received signal strengths and the readings during the offline phase. + Indoor localization based on received \docWIFI{} signal strengths (RSSI) dates back to the year + 2000 and the work of Bahl and Padmanabhan \cite{radar}. During an one-time offline-phase, a + multitude of reference measurements are conducted. During the online-phase, where the pedestrian + walks along the building, those prior measurements are compared against live readings. + The pedestrian's location is inferred using the $k$-nearest neighbor(s) based on the Euclidean distance between currently + received signal strengths and the readings during the offline-phase. Inspired by this initial work, Youssef et al. \cite{horus} proposed a more robust, probabilistic - approach. Fingerprints were placed every \SI{1.52}{\meter} and estimated by scanning each location - 100 times. The resulting signal strength propagation for one location is hereafter denoted by a histogram. + approach. Their fingerprints were placed every \SI{1.52}{\meter} and estimated by scanning each location + 100 times. The resulting signal strength distribution for each location is hereafter encoded by a histogram. The latter can be compared against live measurements to infer its matching-probability. The center of mass among the $k$ highest probabilities, including their weight, describes the pedestrian's current location. % - In \cite{ProbabilisticWlan}, a similar approach is used and compared against nearest neighbor and machine learning. - Furthermore, they mention potential issues of unseen transmitters and describe a simple heuristic of how to handle such cases. + In \cite{ProbabilisticWlan}, a similar approach is used and compared against nearest neighbor, kernel-density-estimation and machine learning. + Furthermore, they mention potential issues of (temporarily) invisible transmitters and describe a simple heuristic of how to handle such cases. - Meng et al \cite{secureAndRobust} further discuss several fingerprinting issues like environmental changes - after the fingerprints were recorded. They propose an outlier detected based on RANSAC to remove potentially + Meng et al. \cite{secureAndRobust} further discuss several fingerprinting issues like environmental changes + after the fingerprints were recorded. They propose an outlier detection based on RANSAC to remove potentially distorted measurements and thus improve the matching process. - Despite a very high accuracy due to real-world comparisons, all approaches suffer from tremendous setup- - and maintainance times. + Despite a very high accuracy due to real-world comparisons, aforementioned approaches suffer from tremendous setup- + and maintainance times. + Using robots instead of human workforce to accurately gather the necessary + fingerprints might thus be a viable choice \cite{robotFingerprinting}. + Being cheaper and more accurate, this technique can also + be combined with SLAM for cases where the floorplan is unavailable. - Therefore it makes sense to replace those time consuming fingerprints by model predictions. - Those are a well established research field, mainly used to determine the \docWIFI{}-coverage - for new installations. \cite{ANewPathLossPrediction, PredictingRFCoverage, empiricalPathLossModel} + Besides using real world measurements via fingerprinting, model predictions can be used to determine + signal strengths for arbitrary locations. Propagation models are a well established field of research, + initially used to determine the \docWIFI{}-coverage for new installations. + While many of them are intended for outdoor and line-of-sight purposes, they are often applied to indoor use-cases as well + \cite{ANewPathLossPrediction, PredictingRFCoverage, empiricalPathLossModel}. + + The model-based approach presented by Chintalapudi et al. \cite{WithoutThePain} works without any prior knowledge. + During a setup phase, pedestrians just walk within the building and transmit all observations to a central + server. Some GPS fixes with well known position (e.g. entering and leaving the building) observed by the pedestrians + are used as reference points. A genetic optimization algorithm hereafter estimates both, the parameters for a + signal strength prediction model and the pedestrian's locations during the walk. The estimated parameters + can be refined using additional walks and may hereafter be used for the indoor localization process. + Likewise, it is possible to apply a global optimization that also determines a vague floorplan for the building \cite{crowdinside}. - einfach messen, ab und zu einen GPS fix und danach genetisch alles zuusammenoptimieren. also kein vorwissen - \cite{WithoutThePain} + As described in previous works, signal strength propagation strongly depends on the transmitter's surroundings and thus on the buildings + architecture. + %This induces both, the need for more complex prediction models and the need for filtering approaches + %to limit the impact of potentially erroneous readings. + % + Approaches based on timing like TOA and TDOA as used within the GPS or methods estimating the signal's angle-of-arrival (AOA) + are more accurate, and mostly invariant to architectural obstacles \cite{TimeDifferenceOfArrival1, TOAAOA}. + However, each of those requires special hardware to work. + % + We therefore focus on the well-known RSSI that is available on each commodity smartphone and use a + a simple signal strength prediction model to estimate the most probable location given the phone's observations. + To reduce the prediction error, we propose a new model based on multiple simple ones. + Several strategies to optimize such a model and the to-be-expected accuracy are hereafter discussed and evaluated. - das muesste noch was aehnliches sein: - \cite{crowdinside} - - - - - neben signalstärke gibt es noch viele andere methoden über laufzeiten wie beim gps etc. - diese erfordern meist aber spezial-hardware und laufen deshalb nicht so einfach auf dem smartphone [= ueberleitung!] - - - - \cite{secureAndRobust} - - -andere methoden neben signalstärke -\cite{TimeDifferenceOfArrival1} \cite{TOAAOA} - -\cite{Ebner-15} diff --git a/tex/chapters/system.tex b/tex/chapters/system.tex index 0e6c081..57292a2 100755 --- a/tex/chapters/system.tex +++ b/tex/chapters/system.tex @@ -5,13 +5,13 @@ using recursive density estimation seen in \refeq{eq:recursiveDensity}. \begin{equation} - \arraycolsep=1.2pt - \begin{array}{ll} - &p(\mStateVec_{t} \mid \mObsVec_{1:t}) \propto\\ - &\underbrace{p(\mObsVec_{t} \mid \mStateVec_{t})}_{\text{evaluation}} + %\arraycolsep=1.2pt + %\begin{array}{ll} + p(\mStateVec_{t} \mid \mObsVec_{1:t}) \propto\\ + \underbrace{p(\mObsVec_{t} \mid \mStateVec_{t})}_{\text{evaluation}} \int \underbrace{p(\mStateVec_{t} \mid \mStateVec_{t-1}, \mObsVec_{t-1})}_{\text{transition}} \underbrace{p(\mStateVec_{t-1} \mid \mObsVec_{1:t-1})d\vec{q}_{t-1}}_{\text{recursion}} \enspace, - \end{array} + %\end{array} \label{eq:recursiveDensity} \end{equation} diff --git a/tex/chapters/work.tex b/tex/chapters/work.tex index 98a7316..abcdc7b 100755 --- a/tex/chapters/work.tex +++ b/tex/chapters/work.tex @@ -42,7 +42,8 @@ \label{eq:logDistModel} \end{equation} - The log distance model \cite{TODO} in \refeq{eq:logDistModel} is a commonly used signal strength prediction model that + The log distance model \cite{IntroductionToRadio, WirelessCommunications} in \refeq{eq:logDistModel} is a commonly + used signal strength prediction model that is intended for line-of-sight predictions. However, depending on the surroundings, the model is versatile enough to also serve for indoor purposes. % @@ -56,7 +57,8 @@ As \mPLE{} depends on the architecture around the transmitter, the model is bound to homogenous surroundings like one floor, solely divided by drywalls of the same thickness and material. % - The log normal shadowing model is a slight modification, to adapt the log distance model to indoor use cases. + The log normal shadowing-, or wall-attenuation-factor model \cite{PathLossPredictionModelsForIndoor} + is a slight modification, to adapt the log distance model to indoor use cases. It introduces an additional parameter, that considers obstacles between (line-of-sight) the \docAPshort{} and the location in question by attenuating the signal with a constant value. % diff --git a/tex/manyfoot.sty b/tex/manyfoot.sty new file mode 100755 index 0000000..f11b03f --- /dev/null +++ b/tex/manyfoot.sty @@ -0,0 +1,405 @@ +%% +%% This is file `manyfoot.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% manyfoot.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% This file is a generated file from the sources of the `ncctools' +%% bundle. +%% +%% You are not allowed to modify this file. +%% +%% You are allowed to distribute this file if and only if +%% it is distributed with the corresponding source files in +%% the `ncctools' bundle. +%% +%% For the copying and distribution conditions of the source files, +%% see the README file distributed with the ncctools bundle. +%% +%% File: manyfoot.dtx Copyright (C) 1998--2005 by Alexander I. Rozhenko +%% +\NeedsTeXFormat{LaTeX2e}[1993/12/01] +\ProvidesPackage{manyfoot} + [2005/09/11 v1.10 Many Footnote Levels Package (NCC)] +\RequirePackage{nccfoots} +\newcommand{\extrafootnoterule}{} +\DeclareOption{ruled}{\def\extrafootnoterule{\defaultfootnoterule}} +\newdimen\MFL@columnwidth +\def\MFL@floathook{\MFL@columnwidth\columnwidth} +\long\def\MFL@insert#1#2{% + \insert#1{\splittopskip\footnotesep \splitmaxdepth \dp\strutbox + \floatingpenalty\@MM #2% + }% + \FN@mf@prepare +} +\providecommand\FN@mf@prepare{} +\let\MFL@realinsert\MFL@insert +\def\MFL@applyhook#1{\csname MFL@hook\string#1\endcsname} +\let\MFL@startplain\@gobble +\@onlypreamble\MFL@startplain +\let\MFL@processplain\@gobble +\long\def\MFL@fnoteplain#1#2#3{\NCC@makefnmark{#2}% + \MFL@insert#1{\reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \hsize\MFL@columnwidth \@parboxrestore + \protected@edef\@currentlabel{\@thefnmark}% + \color@begingroup + \MFL@applyhook{#1}% + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#3\@finalstrut\strutbox}% + \color@endgroup + }% +} +\newif\ifMFL@paraindent \MFL@paraindenttrue +\DeclareOption{para}{% + \newskip\footglue + {\footnotesize \global\footglue=1em plus.3em minus.3em } + \newif\ifMFL@split \MFL@splitfalse + \newcommand\SplitNote{\MFL@splittrue} + \def\MFL@startpara#1{% + \global\advance\skip#1\MFL@paraskip + \MFL@setsplit{#1}{\MFL@applyhook{#1}}% + } + \@onlypreamble\MFL@startpara + \def\MFL@fnotepara#1#2#3{\let\@thefnmark\@empty + \NCC@makefnmark{#2}% + \MFL@insert#1{\reset@font\footnotesize + \ifx\@thefnmark\@empty \@tempswafalse \else + \@tempswatrue + \protected@edef\@currentlabel{\@thefnmark}% + \fi + \color@begingroup + \if@tempswa + \setbox\@tempboxa\hbox{\@makefnmark}% + \ifMFL@paraindent + \@tempdima.8em \advance\@tempdima-\wd\@tempboxa + \ifdim \@tempdima<\z@ \@tempdima\z@ \fi + \else + \@tempdima\z@ + \fi + \fi + \setbox\@tempboxa\hbox{% + \if@tempswa + \hskip\@tempdima\unhbox\@tempboxa\nobreak + \fi + \ignorespaces#3\unskip\strut + \ifMFL@split \penalty\m@ne\space \else + \penalty-10 \hskip\footglue + \fi + }% + \dp\@tempboxa\z@ \ht\@tempboxa\MFL@fudgefactor\wd\@tempboxa + \box\@tempboxa + \color@endgroup + }% + } + \def\MFL@processpara#1{% + \advance\@tempskipa -\MFL@paraskip + \edef\MFL@skip{\vskip\the\@tempskipa\relax}% + \setbox#1\vbox{% + \unvbox#1\setbox\@tempboxa\hbox{}\MFL@makehhbox + \setbox\@tempboxa\hbox{\unhbox\@tempboxa\MFL@removehboxes}% + \footnotesize + \hsize\MFL@columnwidth \@parboxrestore + \ifMFL@paraindent + \@ifundefined{footnotemargin}% + {\parindent\footglue}% + {\parindent\footnotemargin\relax + \ifdim\parindent<\z@ \parindent\footglue + \else \advance\parindent -0.8em \fi}% + \fi + \csname MFL@split\string#1\endcsname + \rule\z@\footnotesep + \unhbox\@tempboxa\unskip + \ifnum\lastpenalty=\m@ne \parfillskip\z@ + \MFL@setsplit{#1}{\noindent}% + \else + \MFL@setsplit{#1}{\MFL@applyhook{#1}}% + \fi + }% + } + \def\MFL@makehhbox{% + \loop\setbox\z@\lastbox \ifhbox\z@ + \setbox\@tempboxa\hbox{\box\z@\unhbox\@tempboxa}% + \repeat + \ifvbox\z@ \unvbox\z@ \MFL@makehhbox \fi + } + \def\MFL@removehboxes{\setbox\@tempboxa\lastbox + \ifhbox\@tempboxa{\MFL@removehboxes}\unhbox\@tempboxa\fi + } + \def\MFL@setsplit#1#2{% + \expandafter\gdef\csname MFL@split\string#1\endcsname{#2}% + } + \g@addto@macro\MFL@floathook{% + \begingroup + \footnotesize \@tempdima\normalbaselineskip + \multiply \@tempdima \@cclvi + \@tempdimb \columnwidth + \divide \@tempdimb \@cclvi + \divide \@tempdima \@tempdimb + \xdef\MFL@fudgefactor{\strip@pt\@tempdima}% + \endgroup + } + \newcommand*\ExtraParaSkip[1]{% + \def\MFL@xparaskip{\advance\@tempdima#1\relax}% + } + \let\MFL@xparaskip\relax + \@onlypreamble\ExtraParaSkip + \@onlypreamble\MFL@xparaskip + \AtBeginDocument{% + \begingroup + \footnotesize + \@tempdima\footnotesep + \advance\@tempdima -\ht\strutbox + \ifdim\@tempdima<\z@ \@tempdima\z@ \fi + \advance\@tempdima.5\normalbaselineskip + \MFL@xparaskip % Add extra para skip + \xdef\MFL@paraskip{\the\@tempdima\relax}% + \endgroup + } +} +\DeclareOption{para*}{% + \@ifundefined{MFL@startpara}{\ExecuteOptions{para}}{}% + \MFL@paraindentfalse +} +\newif\ifMFL@perpage \MFL@perpagefalse +\DeclareOption{perpage}{\MFL@perpagetrue} +\ProcessOptions\relax +\ifMFL@perpage \RequirePackage{perpage}\fi +\def\MFL@list{} +\newcommand*{\SelectFootnoteRule}[2][0]{% + \edef\@tempa{\noexpand\MFL@selectrule{#1}{% + \expandafter\noexpand\csname #2footnoterule\endcsname}}% + \@ifnextchar[{\@tempa}{\@tempa[]}% +} +\def\MFL@selectrule#1#2[#3]{\def\MFL@rule{\MFL@joinrule{#1}{#2}{#3}}} +\SelectFootnoteRule{extra}% Set the default footnote rule +\@onlypreamble\SelectFootnoteRule +\@onlypreamble\MFL@selectrule +\@onlypreamble\MFL@rule +\newcommand{\SetFootnoteHook}[1]{\def\MFL@footnotehook{\MFL@fhook{#1}}} +\@onlypreamble\SetFootnoteHook +\@onlypreamble\MFL@footnotehook +\SetFootnoteHook{}% Empty hook by default +\long\def\MFL@fhook#1#2{% + \expandafter\def\csname MFL@hook\string#2\endcsname{#1}% + \SetFootnoteHook{}% +} +\@onlypreamble\MFL@fhook +\newcommand*{\newfootnote}[2][plain]{% + \@ifundefined{MFL@fnote#1}{% + \PackageError{manyfoot}{Unknown footnote style #1}% + {Known styles are `plain' and `para'\MessageBreak + (if the package was loaded with the para or para* option)}}{}% + \expandafter\MFL@newinsert\csname footins#2\endcsname + \edef\@tempa{\noexpand\newcommand + \expandafter\noexpand\csname Footnotetext#2\endcsname + {\expandafter\noexpand\csname MFL@fnote#1\endcsname{% + \expandafter\noexpand\csname footins#2\endcsname}}% + \noexpand\MFL@footnotehook{% + \expandafter\noexpand\csname footins#2\endcsname}% + }% + \@tempa + \@cons\MFL@list{{#1}\csname footins#2\endcsname}% +} +\@onlypreamble\newfootnote +\def\MFL@newinsert#1{\newinsert#1% + \expandafter\let\csname MFL@join\number #1\endcsname \MFL@rule + \SelectFootnoteRule{extra}% Reset to default rule again + \skip#1\skip\footins \dimen#1\dimen\footins \count#1\count\footins +} +\@onlypreamble\MFL@newinsert +\def\MFL@makemark#1#2#3{% + \FN@mf@check + \@ifnextchar[{\MFL@xmkmark{#1}{#3}}{#2{#1}\MFL@mkmark{#1}{#3}}% +} +\providecommand\FN@mf@check{} +\def\MFL@xmkmark#1#2[#3]{% + \begingroup + \csname c@#1\endcsname #3\relax + \unrestored@protected@xdef\@thefnmark{\csname the#1\endcsname}% + \endgroup + #2% +} +\def\MFL@mkmark#1#2{\protected@xdef\@thefnmark{\csname the#1\endcsname}% + #2% +} +\newcommand*{\DeclareNewFootnote}[2][plain]{% + \@ifnextchar[{\MFL@declare{#1}{#2}}{\MFL@declare{#1}{#2}[arabic]}% +} +\def\MFL@declare#1#2[#3]{% + \newfootnote[#1]{#2}% + \edef\@tempa{\noexpand\newcounter{footnote#2}% + \noexpand\renewcommand + \expandafter\noexpand\csname thefootnote#2\endcsname{% + \expandafter\noexpand\csname @#3\endcsname + \expandafter\noexpand\csname c@footnote#2\endcsname + }% + \ifMFL@perpage \noexpand\MakePerPage{footnote#2}\fi + \noexpand\newcommand + \expandafter\noexpand\csname footnote#2\endcsname{% + \noexpand\MFL@makemark{footnote#2}{\noexpand\stepcounter}{% + \noexpand\@footnotemark + \noexpand\let\noexpand\@tempb\noexpand\@thefnmark + \expandafter\noexpand\csname Footnotetext#2\endcsname{% + \noexpand\@tempb + }% + }% + }% + \noexpand\newcommand + \expandafter\noexpand\csname footnotemark#2\endcsname{% + \noexpand\MFL@makemark{footnote#2}{\noexpand\stepcounter}{% + \noexpand\@footnotemark + }% + }% + \noexpand\newcommand + \expandafter\noexpand\csname footnotetext#2\endcsname{% + \noexpand\MFL@makemark{footnote#2}{\noexpand\@gobble}{% + \noexpand\let\noexpand\@tempb\noexpand\@thefnmark + \expandafter\noexpand\csname Footnotetext#2\endcsname{% + \noexpand\@tempb + }% + }% + }% + \noexpand\newcommand + \expandafter\noexpand\csname Footnotemark#2\endcsname{% + \noexpand\Footnotemark + }% + \noexpand\newcommand + \expandafter\noexpand\csname Footnote#2\endcsname[1]{% + \noexpand\Footnotemark{####1}% + \expandafter\noexpand\csname Footnotetext#2\endcsname{####1}% + }% + }% + \@tempa +} +\@onlypreamble\DeclareNewFootnote +\@onlypreamble\MFL@declare +\def\MFL@start#1{\csname MFL@start#1\endcsname} +\@onlypreamble\MFL@start +\newcommand{\footnoterulepriority}{1} +\newif\ifMFL@joined \MFL@joinedfalse +\def\MFL@joinnotes#1{% + \ifMFL@joined #1% + \else + \let\MFL@savedrule \footnoterule + \let\MFL@currule \defaultfootnoterule + \ifvoid \footins + \let\MFL@curpriority \footnoterulepriority + \else + \let\MFL@curpriority \m@ne + \fi + \let\MFL@elt\@elt + \let\@elt\MFL@join \MFL@list + \let\@elt\MFL@elt + \MFL@joinedtrue #1\MFL@joinedfalse + \let\footnoterule \MFL@savedrule + \fi +} +\def\MFL@join#1#2{\csname MFL@join\number #2\endcsname{#1}{#2}} +\def\MFL@joinrule#1#2#3#4#5{% + \ifnum #1<\MFL@curpriority \else + \let\MFL@currule#2% + \def\MFL@curpriority{#1}% + \fi + \ifvoid#5\else + \@tempskipa\skip#5% + \MFL@ifmcol{\divide\@tempskipa\col@number}{}% + \edef\MFL@skip{\vskip\the\@tempskipa\relax}% + \csname MFL@process#4\endcsname #5% + \ifvoid\footins + \let\footnoterule\MFL@currule + \setbox\footins\vbox{#3\unvbox#5}% + \else + \setbox\footins\vbox{% + \unvbox\footins\MFL@skip\MFL@currule#3\unvbox#5% + }% + \fi + \let\MFL@curpriority \m@ne + \fi +} +\def\MFL@reinsout#1#2{\ifvoid#2\else + \ifnum\count\@currbox>\z@ + \advance\@pageht \ht#2% + \advance\@pageht \skip#2% + \advance\@pageht \dp#2% + \fi + \insert#2{\unvbox#2}% + \fi +} +\def\MFL@reinsert{{\let\@elt\MFL@reins \MFL@list}} +\def\MFL@reins#1#2{\ifvoid#2\else\insert#2{}\fi} +\long\def\MFL@mpinsert#1#2{% + \global\setbox#1\vbox{% + \unvbox#1\setbox\@tempboxa\lastbox + \ifvbox\@tempboxa \unvbox\@tempboxa \fi + \vbox{#2}% + }% +} +\def\MFL@mpreinsert#1#2{% + \ifvoid#2\else + \setbox\@tempboxa\vbox{\unvbox#2\global\setbox#2\lastbox}% + \setbox\z@\box#2% + \ifdim\ht\@tempboxa>\z@ \MFL@realinsert#2{\box\@tempboxa}\fi + \MFL@realinsert#2{\unvbox\z@}% + \fi +} +\def\MFL@minipage{% + \ifinner\else + \MFL@reinsert \let\MFL@insert\MFL@mpinsert + \fi +} +\def\MFL@endminipage{% + \ifinner\else + {\let\@elt\MFL@mpreinsert \MFL@list}% + \fi +} +\def\MFL@mult#1#2{% + \multiply\count#2\col@number + \multiply\skip#2\col@number +} +\def\MFL@ifmcol#1#2{\@tempswafalse + \ifnum\col@number>\@ne + \ifnum\count\footins>1999 \@tempswatrue \fi + \fi + \if@tempswa #1\else #2\fi +} +\AtBeginDocument{% + {\let\@elt\MFL@start \MFL@list} + \@ifundefined{defaultfootnoterule}{% + \@ifundefined{pagefootnoterule}% + {\let\defaultfootnoterule\footnoterule}% + {\let\defaultfootnoterule\pagefootnoterule}% + }{}% + \let\MFL@doclearpage\@doclearpage + \def\@doclearpage{\MFL@joinnotes\MFL@doclearpage} + \let\MFL@makecol\@makecol + \def\@makecol{\MFL@joinnotes\MFL@makecol} + \g@addto@macro\@reinserts{% + \let\MFL@elt\@elt + \let\@elt\MFL@reinsout \MFL@list + \let\@elt\MFL@elt + } + \MFL@floathook + \g@addto@macro\@floatplacement{\MFL@ifmcol{}{\MFL@floathook}} + \let\MFL@iminipage\@iiiminipage + \def\@iiiminipage{\MFL@minipage\MFL@iminipage} + \g@addto@macro\endminipage\MFL@endminipage + \@ifundefined{multi@column@out} + {\@onlypreamble\MFL@mult \let\MFL@ifmcol\@secondoftwo} + {\let\MFL@mcolout\multi@column@out + \def\multi@column@out{\MFL@joinnotes\MFL@mcolout} + \g@addto@macro\init@mult@footins{% + \let\MFL@elt\@elt + \let\@elt\MFL@mult \MFL@list + \let\@elt\MFL@elt + } + \g@addto@macro\reinsert@footnotes{\MFL@reinsert} + } +} +\endinput +%% +%% End of file `manyfoot.sty'. diff --git a/tex/nccfoots.sty b/tex/nccfoots.sty new file mode 100755 index 0000000..d912759 --- /dev/null +++ b/tex/nccfoots.sty @@ -0,0 +1,41 @@ +%% +%% This is file `nccfoots.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% nccfoots.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% This file is a generated file from the sources of the `ncctools' +%% bundle. +%% +%% You are not allowed to modify this file. +%% +%% You are allowed to distribute this file if and only if +%% it is distributed with the corresponding source files in +%% the `ncctools' bundle. +%% +%% For the copying and distribution conditions of the source files, +%% see the README file distributed with the ncctools bundle. +%% +%% File: nccfoots.dtx Copyright (C) 1998-2005 by Alexander I. Rozhenko +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{nccfoots} + [2005/02/03 v1.2 NCC Footnotes Package (NCC)] +\def\NCC@makefnmark#1{\def\@tempa{#1}% + \ifx\@tempa\@empty \else + \begingroup + \unrestored@protected@xdef\@thefnmark{#1}% + \endgroup + \fi +} +\let\@thefnmark\@empty +\newcommand*{\Footnote}[1]{\Footnotemark{#1}\@footnotetext} +\newcommand*{\Footnotemark}[1]{\NCC@makefnmark{#1}\@footnotemark} +\newcommand*{\Footnotetext}[1]{\NCC@makefnmark{#1}\@footnotetext} +\endinput +%% +%% End of file `nccfoots.sty'.