tex

package
v1.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CiteCmds = []string{`\cite`, `\citep`, `\citet`, `\citeNP`, `\citeyearpar`, `\citeyear`, `\citeauthor`, `\citeA`, `\citealp`, `\citeyearNP`, `\parencite`, `\textcite`, `\nptextcite`, `\incite`, `\nopcite`, `\yrcite`, `\yrnopcite`, `\abbrevcite`, `\abbrevincite`}

CiteCmds is a list of latex citation commands (APA style requires many variations). We include all the variations so they show up in completion.

View Source
var LaTeXCmds = []string{
	`\em`,
	`\emph`,
	`\textbf`,
	`\textit`,
	`\texttt`,
	`\textsf`,
	`\textrm`,
	`\tiny`,
	`\scriptsize`,
	`\footnotesize`,
	`\small`,
	`\normalsize`,
	`\large`,
	`\Large`,
	`\LARGE`,
	`\huge`,
	`\Huge`,
	`\begin`,
	`\end`,
	`enumerate`,
	`itemize`,
	`description`,
	`\item`,
	`figure`,
	`table`,
	`tabular`,
	`array`,
	`\hline`,
	`\cline`,
	`\multicolumn`,
	`equation`,
	`center`,
	`\centering`,
	`\verb`,
	`verbatim`,
	`quote`,
	`\section`,
	`\subsection`,
	`\subsubsection`,
	`\paragraph`,
}

LaTeXCmds is a big list of standard commands

View Source
var LaTeXCmdsAll []string

LaTeXCmdsAll concatenates LaTeXCmds and CiteCmds

View Source
var TheTexLang = TexLang{}

TheTexLang is the instance variable providing support for the Go language

Functions

func HasCite added in v1.0.7

func HasCite(str string) bool

HasCite returns true if string has Prefix in CiteCmds

Types

type TexLang

type TexLang struct {
	Pr   *pi.Parser
	Bibs bibtex.Files `desc:"bibliography files that have been loaded, keyed by file path from bibfile metadata stored in filestate"`
}

TexLang implements the Lang interface for the Tex / LaTeX language

func (*TexLang) AutoBracket added in v0.9.15

func (tl *TexLang) AutoBracket(fs *pi.FileStates, bra rune, pos lex.Pos, curLn []rune) (match, newLine bool)

AutoBracket returns what to do when a user types a starting bracket character (bracket, brace, paren) while typing. pos = position where bra will be inserted, and curLn is the current line match = insert the matching ket, and newLine = insert a new line.

func (*TexLang) CompleteCite added in v0.9.13

func (tl *TexLang) CompleteCite(fss *pi.FileStates, origStr, str string, pos lex.Pos) (md complete.Matches)

CompleteCite does completion on citation

func (*TexLang) CompleteEdit

func (tl *TexLang) CompleteEdit(fss *pi.FileStates, text string, cp int, comp complete.Completion, seed string) (ed complete.Edit)

func (*TexLang) CompleteLine

func (tl *TexLang) CompleteLine(fss *pi.FileStates, str string, pos lex.Pos) (md complete.Matches)

func (*TexLang) FindBibliography added in v0.9.13

func (tl *TexLang) FindBibliography(pfs *pi.FileState) string

func (*TexLang) HiLine

func (tl *TexLang) HiLine(fss *pi.FileStates, line int, txt []rune) lex.Line

func (*TexLang) IndentLine added in v0.9.15

func (tl *TexLang) IndentLine(fs *pi.FileStates, src [][]rune, tags []lex.Line, ln int, tabSz int) (pInd, delInd, pLn int, ichr indent.Char)

IndentLine returns the indentation level for given line based on previous line's indentation level, and any delta change based on e.g., brackets starting or ending the previous or current line, or other language-specific keywords. See lex.BracketIndentLine for example. Indent level is in increments of tabSz for spaces, and tabs for tabs. Operates on rune source with markup lex tags per line.

func (*TexLang) LexLine

func (tl *TexLang) LexLine(fs *pi.FileState, line int, txt []rune) lex.Line

func (*TexLang) Lookup added in v0.9.11

func (tl *TexLang) Lookup(fss *pi.FileStates, str string, pos lex.Pos) (ld complete.Lookup)

Lookup is the main api called by completion code in giv/complete.go to lookup item

func (*TexLang) LookupCite added in v0.9.13

func (tl *TexLang) LookupCite(fss *pi.FileStates, origStr, str string, pos lex.Pos) (ld complete.Lookup)

LookupCite does lookup on citation

func (*TexLang) OpenBibfile added in v1.0.0

func (tl *TexLang) OpenBibfile(fss *pi.FileStates, pfs *pi.FileState) error

OpenBibfile attempts to open the /bibliography file. Sets meta data "bibfile" to resulting file if found, and deletes it if not.

func (*TexLang) ParseDir

func (tl *TexLang) ParseDir(fs *pi.FileState, path string, opts pi.LangDirOpts) *syms.Symbol

func (*TexLang) ParseFile

func (tl *TexLang) ParseFile(fss *pi.FileStates, txt []byte)

func (*TexLang) ParseLine

func (tl *TexLang) ParseLine(fs *pi.FileState, line int) *pi.FileState

func (*TexLang) Parser

func (tl *TexLang) Parser() *pi.Parser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL