Skip to content

Commit

Permalink
fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
cysouw committed Dec 17, 2024
1 parent a9eae71 commit 97afcb8
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 296 deletions.
Binary file modified docs/readme.docx
Binary file not shown.
Binary file modified docs/readme.epub
Binary file not shown.
192 changes: 118 additions & 74 deletions docs/readme.html

Large diffs are not rendered by default.

Binary file modified docs/readme_expex.pdf
Binary file not shown.
118 changes: 64 additions & 54 deletions docs/readme_expex.tex
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{xcolor}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\setcounter{secnumdepth}{5}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\usepackage{unicode-math} % this also loads fontspec
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
% xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
Expand All @@ -32,32 +36,24 @@
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
pdftitle={Using pandoc-ling},
pdfauthor={Michael Cysouw},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\newsavebox\pandoc@box
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
\sbox\pandoc@box{#1}%
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
\else\usebox{\pandoc@box}%
\fi%
}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\usepackage{expex}
\lingset{
belowglpreambleskip = -1.5ex,
Expand All @@ -66,9 +62,14 @@
interpartskip = -0.5ex,
belowpreambleskip = -2ex
}
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
pdftitle={Using pandoc-ling},
pdfauthor={Michael Cysouw},
hidelinks,
pdfcreator={LaTeX via pandoc}}

\title{Using pandoc-ling}
\author{Michael Cysouw}
Expand All @@ -81,8 +82,7 @@
\setcounter{tocdepth}{3}
\tableofcontents
}
\hypertarget{pandoc-ling}{%
\section{pandoc-ling}\label{pandoc-ling}}
\section{pandoc-ling}\label{pandoc-ling}

\emph{Michael Cysouw}
\textless{}\href{mailto:[email protected]}{\nolinkurl{[email protected]}}\textgreater{}
Expand All @@ -105,8 +105,7 @@ \section{pandoc-ling}\label{pandoc-ling}}
\href{https://cysouw.github.io/pandoc-ling/readme_gb4e.pdf}{Latex}.
\end{itemize}

\hypertarget{rationale}{%
\section{Rationale}\label{rationale}}
\section{Rationale}\label{rationale}

In the field of linguistics there is an outspoken tradition to format
example sentences in research papers in a very specific way. In the
Expand Down Expand Up @@ -149,9 +148,8 @@ \section{Rationale}\label{rationale}}
\texttt{tests} to get an idea of the strengths and weaknesses of the
current implementation).

\hypertarget{the-basic-structure-of-a-linguistic-example}{%
\section{The basic structure of a linguistic
example}\label{the-basic-structure-of-a-linguistic-example}}
example}\label{the-basic-structure-of-a-linguistic-example}

Basically, a linguistic example consists of 6 possible building blocks,
of which only the number and at least one example line are necessary.
Expand Down Expand Up @@ -224,7 +222,7 @@ \section{The basic structure of a linguistic

\begin{figure}
\centering
\includegraphics{figure/ExampleStructure.png}
\pandocbounded{\includegraphics[keepaspectratio]{figure/ExampleStructure.png}}
\caption{The structure of a linguistic example.}
\end{figure}

Expand All @@ -244,13 +242,11 @@ \section{The basic structure of a linguistic
overruled. For latex (and beamer) special output is prepared using
various available latex packages (see options, below).

\hypertarget{introducing-pandoc-ling}{%
\section{\texorpdfstring{Introducing
\texttt{pandoc-ling}}{Introducing pandoc-ling}}\label{introducing-pandoc-ling}}
\texttt{pandoc-ling}}{Introducing pandoc-ling}}\label{introducing-pandoc-ling}

\hypertarget{editing-linguistic-examples}{%
\subsection{Editing linguistic
examples}\label{editing-linguistic-examples}}
examples}\label{editing-linguistic-examples}

To include a linguistic example in Markdown \texttt{pandoc-ling} uses
the \texttt{div} structure, which is indicated in Pandoc-Markdown by
Expand Down Expand Up @@ -460,8 +456,7 @@ \subsection{Editing linguistic
\xe
\end{samepage}

\hypertarget{interlinear-examples}{%
\subsection{Interlinear examples}\label{interlinear-examples}}
\subsection{Interlinear examples}\label{interlinear-examples}

For interlinear examples with aligned source and gloss, the structure of
a \texttt{lineblock} is used, starting the lines with a vertical line
Expand Down Expand Up @@ -606,9 +601,30 @@ \subsection{Interlinear examples}\label{interlinear-examples}}
\endgl
\xe

\hypertarget{cross-referencing-examples}{%
Just for testing: a single interlinear example without header (which
resulted in a latex-linguex error in earlier versions).

\begin{verbatim}
::: {.ex formatGloss=true}
|
| Dit is een lui voorbeeld
| DEM COP DET lazy example
| This is a lazy example.
:::
\end{verbatim}

\begin{samepage}
\ex[*=]<ex13>
\begingl
\gla \emph{Dit} \emph{is} \emph{een} \emph{lui} \emph{voorbeeld} //
\glb \textsc{dem} \textsc{cop} \textsc{det} lazy example //
\glft `This is a lazy example.'//
\endgl
\xe
\end{samepage}

\subsection{Cross-referencing
examples}\label{cross-referencing-examples}}
examples}\label{cross-referencing-examples}

The examples are automatically numbered by \texttt{pandoc-ling}.
Cross-references to examples inside a document can be made by using the
Expand Down Expand Up @@ -638,15 +654,15 @@ \subsection{Cross-referencing
to the next/last-but-one can be made. Actually, the number of starting
letters can be repeated at will in \texttt{pandoc-ling}, so something
like \texttt{{[}@llllllllast{]}} will also work. It will be formatted as
(\getref{ex6}) after the processing of \texttt{pandoc-ling}. Needless to
(\getref{ex7}) after the processing of \texttt{pandoc-ling}. Needless to
say that in such a situation an explicit identifier would be a better
choice.

Referring to sub-examples can be done by manually adding a suffix into
the cross reference, simply separated from the identifier by a space.
For example, \texttt{{[}@lllast~c{]}} will refer to the third
sub-example of the last-but-two example. Formatted this will look like
this: (\getref{ex12}\,c), smile! However, note that the ``c'' has to be
this: (\getref{ex13}\,c), smile! However, note that the ``c'' has to be
manually determined. It is simply a literal suffix that will be copied
into the cross-reference. Something like \texttt{{[}@last\ hA1l0{]}}
will work also, leading to (\getref{test}\,hA1l0) when formatted (which
Expand Down Expand Up @@ -681,12 +697,10 @@ \subsection{Cross-referencing
\href{https://github.com/cysouw/count-para}{\texttt{count-para}} for a
practical mechanism to add such numbering).

\hypertarget{options-of-pandoc-ling}{%
\subsection{\texorpdfstring{Options of
\texttt{pandoc-ling}}{Options of pandoc-ling}}\label{options-of-pandoc-ling}}
\texttt{pandoc-ling}}{Options of pandoc-ling}}\label{options-of-pandoc-ling}

\hypertarget{global-options}{%
\subsubsection{Global options}\label{global-options}}
\subsubsection{Global options}\label{global-options}

The following global options are available with \texttt{pandoc-ling}.
These can be added to the
Expand Down Expand Up @@ -757,8 +771,7 @@ \subsubsection{Global options}\label{global-options}}
\texttt{gb4e} package. All others have artefacts or errors.
\end{itemize}

\hypertarget{local-options}{%
\subsubsection{Local options}\label{local-options}}
\subsubsection{Local options}\label{local-options}

Local options are options that can be set for each individual example.
The \texttt{formatGloss} option can be used to have an individual
Expand All @@ -782,15 +795,14 @@ \subsubsection{Local options}\label{local-options}}
\end{verbatim}

\begin{samepage}
\ex<ex14>
\ex<ex15>
\[\sum_{i=1}^{n}{i}=\frac{n^2-n}{2}\]\\

\xe
\end{samepage}

\hypertarget{issues-with-pandoc-ling}{%
\subsection{\texorpdfstring{Issues with
\texttt{pandoc-ling}}{Issues with pandoc-ling}}\label{issues-with-pandoc-ling}}
\texttt{pandoc-ling}}{Issues with pandoc-ling}}\label{issues-with-pandoc-ling}

\begin{itemize}
\tightlist
Expand Down Expand Up @@ -840,9 +852,8 @@ \subsection{\texorpdfstring{Issues with
\texttt{latexPackage:\ gb4e}.
\end{itemize}

\hypertarget{a-note-on-latex-conversion}{%
\subsection{A note on Latex
conversion}\label{a-note-on-latex-conversion}}
conversion}\label{a-note-on-latex-conversion}

Originally, I decided to write this filter as a two-pronged conversion,
making a markdown version myself, but using a mapping to one of the many
Expand All @@ -859,8 +870,7 @@ \subsection{A note on Latex
basis I have then made attempts to map them to the various latex
packages.

\hypertarget{a-note-on-implementation}{%
\subsection{A note on implementation}\label{a-note-on-implementation}}
\subsection{A note on implementation}\label{a-note-on-implementation}

The basic structure of the examples are transformed into Pandoc tables.
Tables are reasonably safe for converting in other formats. Care has
Expand Down
Binary file modified docs/readme_gb4e.pdf
Binary file not shown.
Loading

0 comments on commit 97afcb8

Please sign in to comment.