Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
langscibook/langsci/styles/langsci-optional.sty
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
192 lines (155 sloc)
4.58 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%% File: langsci-optional.sty | |
%% Author: Language Science Press (http://langsci-press.org) | |
%% Date: 2016-01-16 16:47:43 UTC | |
%% Purpose: This file contains useful, but not essential, | |
%% macros for books using langscibook.cls | |
%% Language: LaTeX | |
%% Licence: | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Heiko Oberdiek | |
% http://tex.stackexchange.com/questions/136644/vertical-space-in-interaction-with-figure-center-environment | |
\newcommand{\oneline}[1]{% | |
\begingroup | |
\sbox0{\ignorespaces#1\unskip}% | |
\leavevmode | |
\ifdim\wd0>\linewidth | |
\hbox to\linewidth{% | |
\hss\resizebox{\linewidth}{!}{\copy0 }\hss | |
}% | |
\else | |
\copy0 % | |
\fi | |
\endgroup | |
} | |
\newcommand{\centerfit}[1]{% | |
\begingroup | |
\sbox0{\ignorespaces#1\unskip}% | |
\leavevmode | |
\ifdim\wd0>\linewidth | |
\hbox to\linewidth{% | |
\hss\resizebox{\linewidth}{!}{\copy0 }\hss | |
}% | |
\else | |
\centerline{\copy0 }% | |
\fi | |
\endgroup | |
} | |
% Helps to fit verbatim onto one line: | |
% http://tex.stackexchange.com/questions/140593/shrinking-verbatim-text/ | |
\usepackage{fancyvrb} | |
\newenvironment{fitverb} | |
{\SaveVerbatim{rlwv}} | |
{\endSaveVerbatim | |
\sbox0{\BUseVerbatim{rlwv}} | |
\begingroup\center % don't add indentation | |
\ifdim\wd0>\linewidth | |
\resizebox{\linewidth}{!}{\copy0}% | |
\else | |
\copy0 | |
\fi | |
\endcenter\endgroup} | |
\VerbatimFootnotes | |
% http://tex.stackexchange.com/questions/73464/inserting-rtl-text-in-verbatim-environment?rq=1 | |
% verbatim with RTL text | |
%\DefineVerbatimEnvironment{rtlverbatim}{Verbatim}{commandchars=+\[\]} | |
\newcommand{\ispackage}[1]{\if@noftnote% | |
\is{package!{\scshape #1}}% | |
\else% | |
\is{package!{\scshape #1}|fn{*}}% | |
\fi% | |
} | |
% breaks the index | |
%\usepackage{doc} | |
\newcommand{\ispackageb}[1]{ | |
\is{package!\texttt{#1}|(} | |
} | |
\newcommand{\ispackagee}[1]{ | |
\is{package!\texttt{#1}|)} | |
} | |
\newcommand{\isoption}[1]{\if@noftnote% | |
\is{option!\texttt{#1}}% | |
\else% | |
\is{option!\texttt{#1}|fn{*}}% | |
\fi% | |
} | |
\newcommand{\iscommand}[1]{\if@noftnote% | |
\index{#1@{\ttfamily $\backslash$#1}}% | |
\else% | |
\is{{#1@\ttfamily $\backslash$#1}|fn{*}}% | |
\fi% | |
} | |
\newcommand\displaycmd[2]{% | |
\DescribeMacro{#2}\centerline{\cmd{#1}}} | |
% \mex considered evil, as we need explicit reference to examples in XML | |
% % The following allows for a quick reference to following or preceeding examples (\mex{1}) or | |
% % (\mex{0}) but also (\mex{-1}) | |
% % taken from covington.sty (check) | |
% \newcounter{lsptempcnt} | |
% | |
% \newcommand{\mex}[1]{\setcounter{lsptempcnt}{\value{equation}}% | |
% \addtocounter{lsptempcnt}{#1}% | |
% \arabic{lsptempcnt}}% | |
\newcommand{\fitpagewidth}[1]{ | |
\resizebox{\textwidth}{!}{#1} | |
} | |
%add intonation bars over morphemes or words | |
\newcommand{\intline}[2]{\settowidth{\LSPTmp}{#2}\raisebox{#1pt}{\parbox{.1mm}{\rule{\LSPTmp}{.5pt}}}#2} | |
%add rising or falling intonation | |
\newcommand{\dline}[3]{% | |
\parbox{.1mm}{\begin{picture}(0,0)% | |
\put(0,#1){\line(#2,-1){#3}}% | |
\end{picture}% | |
}% | |
} | |
%% rotated table headers | |
% create lengths | |
\newlength{\rotheight} | |
\newlength{\rotwidth} | |
\newcommand{\rotatehead}[2][1cm]{ | |
%width is the width of the parbox | |
%height is the buffer space used to vertically stretch the headere | |
\setlength{\rotwidth}{#1} | |
\setlength{\rotheight}{.85\rotwidth} | |
\begin{rotate}{33}~ %nbsp shifts the content away from the line underneath | |
\parbox{\rotwidth}{\raggedright #2} | |
\end{rotate}% | |
\rule{0pt}{\rotheight} %add zero width rule to get the right table height | |
} | |
% example metadata | |
\newcommand{\langinfo}[3]{{\upshape #1\il{#1}~(% | |
\ifx\\#2\\% | |
\else% | |
#2; | |
\fi% | |
#3)}\nopagebreak[4]\ignorespaces} | |
\newcommand{\fittable}[1]{\resizebox{\textwidth}{!}{#1}} | |
% integrate see also in multiple indexes | |
\def\igobble#1 {} | |
\newcommand{\langsciseealso}{\par\addvspace{.1\baselineskip}\hspace*{1.4cm}\hangindent=1.4cm\seealso} | |
\newcommand{\ilsa}[2]{\il{#1@\igobble | langsciseealso{#2}}} | |
\newcommand{\issa}[2]{\is{#1@\igobble | langsciseealso{#2}}} | |
\usepackage{tabularx} | |
\usepackage{array} | |
\newenvironment{widetabular}[1][1] | |
{\tabularx{#1\textwidth}} | |
{\endtabularx} | |
\newcommand{\citetv}[1]{\citeauthor{#1} (\citeyear*{#1} [this volume])} | |
\newcommand{\citepv}[1]{(\citealt{#1} [this volume])} | |
% Vowel chart tikz commands | |
\newcommand{\aeiou}{% | |
\node at (1.5,0) (a) {a}; | |
\node at (0,3) (i) {i}; | |
\node at (3,3) (u) {u}; | |
\node at (0.5,1.5) (e) {e}; | |
\node at (2.5,1.5) (o) {o}; | |
} | |
\newcommand{\aeiouEO}{% | |
\node at (1.5,0) (a) {a}; | |
\node at (0,3) (i) {i}; | |
\node at (3,3) (u) {u}; | |
\node at (0.25,2) (e) {e}; | |
\node at (2.75,2) (o) {o}; | |
\node at (0.75,1) (E) {ε}; | |
\node at (2.25,1) (O) {ɔ}; | |
} |