diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-11-24 19:46:08 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-11-24 19:46:08 +0000 |
commit | aa1420a6770a5148a153b2b1e4283fb91a9a3d3b (patch) | |
tree | d9582016d27249d388221be878ae5b3c2e6d6265 /Master/texmf/doc/texdoc | |
parent | 01da98ba6f4010aa1cf6163e019c8ebeb24f68bd (diff) |
Texdoc 0.60.
git-svn-id: svn://tug.org/texlive/trunk@16153 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/doc/texdoc')
-rw-r--r-- | Master/texmf/doc/texdoc/News | 12 | ||||
-rw-r--r-- | Master/texmf/doc/texdoc/texdoc.pdf | bin | 195730 -> 192095 bytes | |||
-rw-r--r-- | Master/texmf/doc/texdoc/texdoc.tex | 748 |
3 files changed, 382 insertions, 378 deletions
diff --git a/Master/texmf/doc/texdoc/News b/Master/texmf/doc/texdoc/News index 6de6cec2915..1412794498f 100644 --- a/Master/texmf/doc/texdoc/News +++ b/Master/texmf/doc/texdoc/News @@ -1,3 +1,15 @@ +Version 0.60 +------------ + +Changed the search/alias/score logic. See section 2 of the manual for details, +but here is a primer: +- alias now /adds/ patterns to be search, it is no more a substitution +- new scoring system, partially confugurable, with improved heuristics + +The beginning of the manual has been completely rewritten. + +Bug have been fixed as usual, and probably some others introduced... + Version 0.50 ------------ diff --git a/Master/texmf/doc/texdoc/texdoc.pdf b/Master/texmf/doc/texdoc/texdoc.pdf Binary files differindex 1e11d7435c1..815f4bd0b47 100644 --- a/Master/texmf/doc/texdoc/texdoc.pdf +++ b/Master/texmf/doc/texdoc/texdoc.pdf diff --git a/Master/texmf/doc/texdoc/texdoc.tex b/Master/texmf/doc/texdoc/texdoc.tex index 4939833527e..9d4a4677f39 100644 --- a/Master/texmf/doc/texdoc/texdoc.tex +++ b/Master/texmf/doc/texdoc/texdoc.tex @@ -2,20 +2,24 @@ % written by Manuel Pégourié-Gonnard in 2008, 2009 % distributed under the terms of GPL v3 or later +%!TEX encoding=latin1 +%!TEX program=pdflatex + +\setlength\overfullrule{5pt} + \documentclass[a4paper, oneside]{scrartcl} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{textcomp} \usepackage{fixltx2e} -\usepackage{lmodern} \edef\ttmodern{\ttdefault} -\usepackage[osf]{mathpazo} -\renewcommand\sfdefault{uop} % optima -\renewcommand\ttdefault{lmvtt} % lm tt proportional +\usepackage{tgbonum} +\usepackage{tgheros} +\usepackage[scaled=1.10]{inconsolata} \renewcommand\familydefault{\sfdefault} \normalfont \newcommand\otherfamily{\rmfamily} -\newcommand\mylangle{\textlangle} -\newcommand\myrangle{\textrangle} +\newcommand\mylangle{$\langle$} +\newcommand\myrangle{$\rangle$} \usepackage{xargs, xspace, fancyvrb, xcolor, pifont, calc, ifmtarg, mathstyle} @@ -23,7 +27,8 @@ \titlelabel{\makebox[0pt][r]{\thetitle\kern1pc}} \titleformat{\subsubsection}[runin]{\otherfamily\itshape}{% \makebox[0pt][r]{\thetitle\kern1pc}}{% - 0pt}{}[\maybedot\space --- ] + 0pt}{}[\maybedot\space --- \kern0pt] +\titlespacing{\subsubsection}{0pt}{0.5\baselineskip}{0pt} \usepackage{enumitem} \newlength\lssep \setlength\lssep{\smallskipamount} @@ -34,7 +39,7 @@ \usepackage[bookmarks=true]{hyperref} \hypersetup{% bookmarksnumbered=true, bookmarksopen=true, bookmarksopenlevel=2, - pdftitle=texdoc: finding and viewing TeX documentation, + pdftitle=texdoc: find and view documentation in TeX Live, pdfauthor=Manuel Pégourié-Gonnard, pdfsubject=texdoc's user manual, pdfkeywords={texdoc, TeX Live, manual}} @@ -62,8 +67,6 @@ \definecolor{input}{rgb}{1.0,0,0} \newcommand\inputcolorname{red} \hypersetup{colorlinks=true, linkcolor=links, urlcolor=links, citecolor=links} -\newcommand\textpa[1]{% % noms d'extensions (package) - {\normalfont\color{special}\otherfamily #1}} \newcommand\cofont{% % code \color{code}\normalfont\ttfamily} \newcommand\textco[1]{{\cofont#1}} @@ -78,7 +81,7 @@ \newcommand\file{\nolinkurl} % take care of nbsp -\catcode`\ 10\relax +\catcode`\ 10\relax \newcommand\meta[1]{% % variantes à remplacer {\color{special}\mylangle\textme{#1}\myrangle}} @@ -138,296 +141,286 @@ }{% \endcommandes} +\makeatletter \newenvironment{htcode}{% % code en hors-texte \SaveVerbatim[samepage, gobble=2]{verbmat}% }{% \endSaveVerbatim \par\medskip\noindent\hspace*{\parindent}% \BUseVerbatim{verbmat}% - \par\medskip} + \par\medskip\@endpetrue} +\makeatother \DefineShortVerb{\©} \setkomafont{title}{} \setkomafont{subtitle}{\Large} \deffootnote[1.5em]{1.5em}{1em}{\textsuperscript{\thefootnotemark}\thinspace} -\newcommand\texdoc{\textpa{texdoc}\xspace} +\newcommand\texdoc{texdoc\xspace} +\newcommand\tdml{\href{mailto:texdoc@tug.org}{texdoc mailing list}\xspace} \title{\texdoc} -\subtitle{Finding \& viewing \TeX documentation - } +\subtitle{Find \& view documentation in \TeX\ Live} \author{\url{http://tug.org/texdoc/}\\ Manuel Pégourié-Gonnard} -\date{v0.47 2009-10-12} +\date{v0.60 2009-11-24} \begin{document} \VerbatimFootnotes \maketitle -\section{Basic Usage, Modes}\label{s-basics} +\section{Quick guide} -\begin{cmdsubsec}{Normal (view) mode}{ss-view} - texdoc «name» -\end{cmdsubsec} +\subsection{Basics} -The simplest way to use \texdoc is just to type\footnote{In a command line. If - you don't know how to open one, look for Start$\to$Execute and type ©cmd© on - Windows, or use the ``terminal'' icon on Mac OS X. If you are using another - flavour of Unix, you probably know what to do.} ©texdoc© followed by the -name of the package whose documentation you want to read. It usually finds -the documentation for you and opens it in the appropriate reader. That's it: -easy and usually fast. The rest of this manual describes what to do if -this doesn't work exactly as you like and you want to customise things, and -how to do more extensive searchs. +Open a command line\footnote{On windows, use ``Execute'' from the Start menu + and type ©cmd©. On Mac OS X, use the ``terminal'' icon on Mac OS X. If you + are using another flavour of Unix, you probably know what to do.} and type +©texdoc «name»©: the documentation of the ©«name»© package will pop up. Of +course, replace ©«name»© with the actual name of the package you want to learn +about. You can also look for the documentation of more than one package at +once: just give many names as arguments. + +The rest of this section describes the most usual options, like how to +see all documentation related to a package or use a different viewer. + +\subsection{Modes}\label{ss-modes} + +\texdoc has different modes that determine how results will be handled. The +default mode, called ``view'' mode, is to open the first (supposedly the best) +result in a viewer. It is rather handy when you know what you want to read, +and want to access it quickly. On the other hand, there may be other relevant +documents for the given ©«name»©, which are ignored in view mode. + +The so-called ``list mode'' makes \texdoc list all relevant documentation and +ask you which one you want to view. It is useful when there a other +interesting sources of information besides the package's main documentation. + +There is also a ``mixed'' mode, intended to combine the best of view mode and +list mode: if there is only one relevant result, then \texdoc opens it in a +viewer, else it offers you a menu. + +Usually, \texdoc shows you only results it considers relevant. If there are no +``good'' results, it falls back to less relevant results. You can force +\texdoc to show you also ``bad'' results even when there are good ones by +using the ``showall'' mode. (This implies using a menu rather than starting a +viewer.) + +You can select with command-line options: use ©texdoc «option» «name»© with +one of the following options: ©-w© or ©--view© for view mode, ©-m© or +©--mixed© for mixed mode, ©-l© or ©--list© for list mode, ©-s© or ©--showall© +for showall mode. + +If you always (or mostly) use the same mode, it is probably easier to +select it in a configuration file than to always use the command-line +option. For this, see the next section. + +\subsection{Configuration files}\label{ss-quick-file} + +\texdoc use various configuration files, which you can see using the ©-f© or +©--files© options. The second entry in this list is marked with a star ©(*)©: +it is the file you should use for your personal preferences as a user; you may +need to create it (and the parents directories). + +In order to select you favorite mode, just insert a line ©mode = «yourmode»© +in this files, where ©«yourmode»© is one of ©view©, ©mixed©, ©list© or +©showall©. + +The configuration files can be used to tweak \texdoc in many ways, the most +useful of which is probably the selection of the viewers for various types of +documents, explained in the next section. + +\subsection{Viewers} + +\texdoc's mechanism for choosing a viewer varies according to your platform. +On Windows and MacOS, it uses your file associations like when you +double-click files in the Explorer or the Finder (except for the text viewer, +which is always a pager). On Unix, it tries to find a viewer in the path from +a list of ``known' viewers. + +You may want to select a different viewer for some kind of file. This is +achieved by the various ©viewer_«ext»© configuration options, where ©«ext»© is +the extension corresponding to the file type. For example, if you want to set +xpdf as your default PDF viewer, and run it in the background, insert the line +©viewer_pdf = xpdf %s &© in your configuration file. Here, ©%s© stands for the +name of the file to view. + +\subsection{Conclusion} + +We have now covered the most common needs. The next part explains +how \texdoc proceeds to find the best results. +The default configuration file tries hard to set appropriate values so that +you have a good out-of-the-box experience, but you may want to understand the +underlying mechanisms and adapt them to your needs. The final part is a full +reference for configuration options, including points omitted in the present +part. + +Your feedback is very welcome of the \tdml. Feel free to post comments, bug +reports, suggestions for improvements (inc. new aliases), even without +subscribing. + +\clearpage + +\section{File search, aliases, score} + +\subsection{An overview of how texdoc works} + +When you type ©texdoc «keyword»©, texdoc browses the trees containing +documentation (given by the \href{http://www.tug.org/kpathsea/} {kpathsea} +variable ©TEXDOCS©), lists all files containing ©«keyword»© in their name +(including the directory name) and give them a score based on some simple +heuristics. For example, a file named ©«keyword».pdf©, will get a high score, +©«keyword»-doc© will be preferred over ©«keyword»whatever©, files in a +directory named exactly ©«keyword»© get a bonus, etc. + +There is also some filtering based on extensions: only files with known +extensions are listed, and some extensions get a lesser score. Also, there is +some score adjustments based on keywords; by default, Makefile's get a very +bad score since they are almost never documentation.\footnote{They often end + up in the doc tree, since the source of documentation is often in the same + directory as the documentation itself in \TeX\ Live. Other source files are + discriminated by extension.} + +Then, depending on the mode, the file with the highest score is opened in a +viewer, or the list of results is shown. Usually, only results with a positive +score are displayed, except in showall mode. Result with very bad score (-100 +and below) are never displayed. + +\medskip + +However, this model works only if the documentation for ©«keyword»© has +©«keyword»© in its name, which is not always true. The documentation of the +memoir class is in ©memman.pdf©, for example, but it will be found anyway +since it is in a directory named memoir. But there are more complicated cases: +the documentation for mathptmx is in ©psnfss2e.pdf©, which is quite more +complicated to guess.\footnote{But not totally impossible: using the \TeX\ + Live database, texdoc can know which documentation files are associated with + a given ©.sty© file. Here, it could guess that the documentation is either + ©psfonts.pdf© of ©psnfss2e.pdf©. This will probably be done in a future + version.} + +Here comes the notion of \emph{alias}: in the default configuration file, +mathptmx is aliased to psnfss2e, so that when you type ©texdoc mathptmx©, +texdoc knows it has to look also for psnfss2e. Note that texdoc will also look +for the original name, and that a name can be aliased to more than one new +name (this is new in texdoc 0.60). + +\medskip + +We will soon see how you can configure this, but let's give a few definitions +about how a file can match keyword first (all matching is case-insensitive): +\begin{enumerate} + \item The keyword is a substring of the file name. + \item The keyword is a ``subword'' of the file name; words are defined as a + sequence of alphanumeric characters delimited by punctuation characters + (there is no space in file names in \TeX\ Live) and a subword is a + substring both ends of which are a word boundary. + \item The keyword can match ``exactly'' the file name: that is, the file + name is the keyword + and extension. +\end{enumerate} -Before the description of \texdoc's different modes, just a word words about -the typographic conventions in this manual. Things like ©«name»© in the above -title mean that they should be replaced by what you actually want. For -example, if you want to read \package{hyperref}'s manual, type -©texdoc hyperref©. Sometimes there will be complete examples like this: +\subsection{Alias directives}\label{ss-alias} \begin{htcode} - þ texdoc -s babelbib þ - 1 /usr/local/texlive/2008/texmf-dist/doc/latex/babelbib/babelbib.pdf - 2 /usr/local/texlive/2008/texmf-dist/doc/latex/babelbib/tugboat-babelbib.pdf - 3 /usr/local/texlive/2008/texmf-dist/doc/latex/babelbib/ChangeLog - 4 /usr/local/texlive/2008/texmf-dist/doc/latex/babelbib/README - Please enter the number of the file to view, anything else to skip: ¶2¶ + alias «original keyword» = «name» + alias(«score») «original keyword» = «name» \end{htcode} -In this case, what you actually type is in \textcolor{input}{\inputcolorname}, -and the funny symbol \textco{\prompt} represents your shell's prompt, which -can actually be something like ©C:\>© or ©name@host:~%© or funnier. - -\bigskip - -\texdoc's normal mode of operation is to find the more appropriate document -for your request and open it. But sometimes it has a weird notion of -``appropriate'', and you'd better look at the list of all results and choose -to see oen or more of them. For this, \texdoc offers various modes, like the -``search mode'' illustrated above. - -\begin{cmdsubsec}{Search mode}{ss-search} - texdoc -s «name» - texdoc --search «name» -\end{cmdsubsec} - -With the two (equivalent) commands above, \texdoc also looks for documentation -for ©«name»©, but using the \emph{search mode}, which differs from the -normal mode (called \emph{view mode}) on two points: -\begin{itemize} - \item It doesn't start a viewer and offers you a \emph{menu} instead. - \item It always do a \emph{full search}. -\end{itemize} -The first point is rather straightforward on the example. The second deserves -more explanation. - -Usually, \texdoc looks for files named ©«name».pdf© or ©«name».html© etc. (see -\ref{cf-ext_list}), where ©«name»© means what you asked for, in \texlive's -documentation directories, and if cannot find such a file, it tries a full -search: it finds all files which have ©«name»© in their name, or in the -directory's name. In search mode, \texdoc always performs a full search. - -Now look carefully at the previous example. The purpose of search mode is to -allow you to find related documentation, such as the -\href{http://www.tug.org/TUGboat/}{TUGboat} article on \package{babelbib}, -which you might want to read, whereas in normal mode \texdoc offers you no -choice and just displays the user manual ©babelbib.pdf©. On the other hand, -the view mode is much faster when you know exactly what you want to read. - -To try and make you happy, \texdoc offers two other modes, introduced below. - -\begin{cmdsubsec}{List mode}{ss-list} - texdoc -l «name» - texdoc --list «name» -\end{cmdsubsec} - -The \emph{list mode} uses a normal search, but forces \texdoc to give you a -menu instead of choosing itself the documentation to display. It is usefull -when there are many files with the same name but different contents, or many -versions of the same file on your system. - +You can define your own aliases in \texdoc's configuration files +(see~\ref{ss-quick-file} or \ref{ss-prec}). For example, +insert\footnote{Actually, you don't need to do this, the default configuration + file already includes this directive.} \begin{htcode} - þ texdoc -l tex þ - 1 /usr/local/texlive/2008/texmf/doc/man/man1/tex.pdf - 2 /usr/local/texlive/2008/texmf-doc/doc/english/knuth/tex/tex.pdf - Please enter the number of the file to view, anything else to skip: + alias mathptmx = psnfss2e \end{htcode} - -Here the first file is the manual page\footnote{converted in pdf. To allow - texdoc to find and display real man pages in man format, - see~\ref{cf-ext_list}.} of the ©tex© command, while the second is \TeX{}'s -documented source code\dots - -\begin{cmdsubsec}{Mixed mode}{ss-mixed} - texdoc -m «name» - texdoc --mixed «name» -\end{cmdsubsec} - -As the name says, \emph{mixed mode} is an attempt to provide you the best of -the normal (view) and list modes, by mixing them in the following way: If -only one file is found, then \texdoc opens it, and if many are found, it -displays a menu to let you choose. You may want to make this mode the -default, see~\ref{cf-mode}. - -\begin{cmdsubsec}{What's a <name>?}{ss-name} - texdoc «name1» «name2» «...» - texdoc «name.ext» -\end{cmdsubsec} - -To conclude this section on basics, let us just mention two points concerning -the ©«name»© in all previous sections. Is is usually a single name without -extension, but you can also use many names at once: then, depending on the -mode, \texdoc will either open all the corresponding documentation or show you -menus for each of the names you mentioned. For each name, you can also -specifiy the file exention\footnote{It should be an allowed extension, - see~\ref{cf-ext_list}, and preferably have a associated viewer defined, - see~\ref{cf-viewer_*}.} if you want, eg ©texdoc texlive-en.html© lets you -read the \texlive manual in html rather than in pdf format. - -\bigskip - -You can now stop reading this manual unless you have special needs. If you -want to understand the curious ©aliased too© messages that you will sometimes -see, and control them, read section~\ref{s-alias}. If you have problems -viewing certain type of files or want to choose you preferred reader, look at -section~\ref{s-viewer}. Finally, section~\ref{s-ref} is the full -reference concerning \texdoc configuration: while you probably don't want to -read it all at once, you can consult~\ref{cf-mode} if you want to select your -preferred mode and make it the default. - -Finally, be aware of the ©-h© or ©--help© option which provides you a quick -reminder of all available command-line options. - -\section{Aliases, or name substitution}\label{s-alias} - -\subsection{Basic concept}\label{ss-alias-basics} - -The usual search modes of \texdoc assume that the name of the documentation -file is the name of the package, or contains it (at least in the directory -name). However, this is not always true, due either to the author choosing a -fancy name, or packaging peculiarities. To try helping the user to find the -doc even in these cases, \texdoc provides an alias mechanism and comes with a -list of circa 200 pre-defined aliases. +in order to alias mathptmx to psnfss2e. Precisely, it means that files +matching exactly psnfss2e will be added to the result list when you look for +mathptmx, and get a score of 10 (default score for alias results). This is +greater than the results of heuristic scoring: it means that results found via +aliases will always rank before results associated to the original keyword. + +If you want the results associated to a particular alias to have a custom +score instead of the default 10, you can use the optional argument to the +alias directive. This can be usefull if you associate many aliases to +a keyword and want one of them to show up first. + +You can have a look at the configuration file provided (the last shown by +©texdoc -f©) for examples. If you feel one of the aliases you defined locally +should be added to the default configuration, please share it on the \tdml. + +Please note than aliasing is case-insensitive, and the aliases don't cascade: +only aliases associated to the original keyword are used. +Aliases are additive: if you define your own aliases for a keyword in your +configuration file, and there are also aliases for the same keyword in the +default configuration, they will add up. You can prevent the default aliases +from begin applied for a particular keyword by saying ©stopalias «keyword»© in +your personal configuration file. It will keep the aliases defined before +this directive (if any) and prevent all further aliasing on this keyword. + +If, for some reason, you want to prevent any alias from begin used for one +particular session of texdoc, you can use the ©-A© or ©--noalias© command-line +option (see~\ref{cl-a}). + +\subsection{Score directives}\label{ss-score} \begin{htcode} - þ texdoc -l geometry þ - texdoc info: geometry aliased to geometry/manual.pdf - 1 /usr/local/texlive/2008/texmf-dist/doc/latex/geometry/manual.pdf - Please enter the number of the file to view, anything else to skip: ¶0¶ + adjscore «pattern» = «score adjustment» + adjscore(«keyword») «pattern» = «score adjustment» \end{htcode} -The concept of alias is very\footnote{See~\ref{ss-alias-rem} for why it is - actually \emph{too} simple.} simple: as you can see of the above example, -when you type and ©geometry© is aliased to ©geometry/manual.pdf©, then -everything happens as if you actually typed ©texdoc geometry/manual.pdf© -(without any further alias substitution), and \texdoc informs you that -something happened so you can understand the results -(see~\ref{cf-verbosity_level} to get rid of this message): - -\begin{cmdsubsec}{Command line options}{ss-alias-cl} - texdoc -a «options» «name» - texdoc --alias «options» «name» - texdoc -A «options» «name» - texdoc --noalias «options» «name» -\end{cmdsubsec} - -By default, aliased are used in view, list and mixed modes, and disabled in -search mode. But you may want to disable it, because the default alias doesn't -do what you want\footnote{In this case, please report it to - \mailto{texdoc@tug.org}, so that the faulty alias can be updated.} or for -another reason. In this case, you just have to add ©-A© or ©--noalias© to the -options, like: +It is possible to adjust the score of results containing some pattern as a +subword, either globally (for the result of all searches) or only +when searching with a particular keyword. This is done in the +configuration file (\ref{ss-quick-file} or \ref{ss-prec}) using the +©adjustscore© directive. Here are a few examples from the default +configuration file. \begin{htcode} - þ texdoc -A -l geometry þ - 1 /usr/local/texlive/2008/texmf-doc/doc/polish/tex-virtual-academy-pl/ - latex2e/macro/geometry.html - Please enter the number of the file to view, anything else to skip: ¶0¶ + adjscore /Makefile = -1000 + adjscore /tex-virtual-academy-pl/ = -50 + adjscore(tex) texdoc = -10 \end{htcode} -On the contrary, you can force aliasing in search mode by using the ©-a© or -©--alias© option, though it may not prove very useful. +All files named ©Makefile© (and also files names ©Makefile-foo© if there are +any): are ``killed'' : by adjusting their score with such a large negative +value, their final score will most probably be less than -100, so they will +never be displayed. Files from the ©tex-virtual-academy-pl© directory, on the +other hand, are not killed but just get a malus, since they are a common +source of ``fake'' matches which hide better results (even for the lucky ones +who can read polish). -\subsection{Your own aliases}\label{ss-alias-own} +The third directive gives a malus for results containing ©texdoc© only if the +search keyword is ©tex©. Otherwise, such results would get a high score +because the heuristic scoring would think ©texdoc© is the name of \TeX's +documentation. The value -10 is enough to ensure that those results will have +a negative score, so wil not be displayed unless ``showall'' mode is active. -You can define your own aliases, or override the default ones, in \texdoc's -configuration files. You can get a list of those files by typing ©texdoc -f©. -For personal aliases, it is recommended that you use the second file, marked -by a star (see~\ref{ss-prec} for details). You'll probably need to -create in and one or two of the directories containing it. +\textbf{Warning}: Values of scores (like the default score for aliases, the +range of heuristic scoring, etc.) may change in a future version of texdoc. +Scoring is quite new and may need some adjustments. So, don't be surprised if +you need to adapt your scoring directives after a future update of texdoc. +This warning will disappear at some point. -Creating an alias is easy: you just insert a line like -\begin{htcode} - alias geometry = geometry/manual.pdf -\end{htcode} -in your configuration file, and it's all. You can have a look at the -configuration file provided (the last one showed by ©texdoc -f©) for examples. -If you want to permanently unalias something, just insert a line -©«name»=«name»©: it will overwrite the previous alias. - -\subsection{Remarks on aliases}\label{ss-alias-rem} - -Please be aware that this alias feature, or at least its intensive use to try -to find the ``right'' documentation for a given package, should be temporary. -Indeed, one problem is that currently aliases do \emph{hide} other files, while -it is desirable that they just \emph{add} results in some case. However, -defining a coherent behaviour (and how to maintain the needed database) -requires work and time, and is therefore reported to future versions. - -In this vein, it would be desirable to have a notion of ``category'', like -user documentation of a package, or man page of a program, or reference manual -of a program, or documented source code of a package or program, or\dots If -you have ideas about desirable categories and ways they should be handled, -feel free to share them at the usual address. - -\section{Viewer selection}\label{s-viewer} - -A list of default viewers is defined in \texdoc, depending on your platform -(Windows, MacOS X, other Unix). On Windows and MacOS, it uses your file -associations like when you double-click files in the Explorer or the Finder. -On Unix, it tries to find a viewer in the path from a list of ``known' -viewers. - -If you want to use another viewer, you have two ways of telling this to -\texdoc: in your configuration file or using environment variables. If you -hesitate, the configuration file is the recommended way. - -To find your configuration file, type ©texdoc -f© and pick the file marked -with a star (unless you are a system administrator or your home is shared -between many machines whith different architectures, see~\ref{ss-prec}); you -may need to create the file and a few directories. Then you can add lines -like: - -\begin{htcode} - viewer_pdf = (xpdf %s) & - viewer_txt = less -\end{htcode} +\subsection{File extensions} -Here the ©%s© stands for the name of the file to view. The first line sets -©xpdf© as the pdf viewer, and use a bit of shell syntax to force it to run in -the background (the ©()© are here for compatibility with zip support, -see~\ref{s-bugs}). The second line sets ©less© as the text viewer: it doesn't -use ©%s©, which means the filename will be placed at the end of the command. +The allowed file extensions are defined by the configuration item ©ext_list© +(default: pdf, html, txt, ps, dvi, no extension). You can configure it with +a line ©ext_list = «your, list»© in a configuration file. Be aware +that it will completely override the default list, not add to it. An empty +string in the list means files without extension (no dot in the name), while a +star means any extension. -The default extensions allowed are ©pdf©, ©html©, ©txt©, ©dvi©, ©ps©, and no -extension. The ©txt© viewer is used for files without extension. -See~\ref{cf-ext_list} for how to allow for more extensions. +For scoring purposes, there is also a ©badext_list© parameter: files whose +extension is ``bad'' according to this list will get a lesser score (currently +0). This only affect heuristic scoring (results found from the original +keyword, not from aliases). -The corresponding environment variables are ©PDFVIEWER©, ©BROWSER©, ©PAGER©, -©DVIVIEWER©, ©PSVIEWER©. They follow the same convention as values from the -configuration files, and override them if they are set. Since some of those -variable are shared by other programs, you can override them just for \texdoc -by adding ©_texdoc© at the end, like in ©BROWSER_texdoc©. +\clearpage -\section{Full reference}\label{s-ref} +\section{Full reference} -The most useful command-line options, configuration values and all -environment variables have been presented. Here we complete our presentation -and review all in a systematic way. - -\subsection{Precedence}\label{ss-prec} +\subsection{Precedence of configuration sources}\label{ss-prec} Values for a particular setting can come from several sources. They are treated in the following order, where first value found is always used: @@ -460,9 +453,10 @@ its default config file) in your home: see \href{http://tug.org/texdoc/}{the \subsection{Command-line options}\label{ss-cl} -Most of the command-line options correspond to an option that can be set from -the config files. For them, we refer the reader to the description of the -corresponding configuration option. +All command-line options (except the first three below) correspond to +configuration item that can be set in the configuration files: we refer +the reader to the corresponding section for the meaning of this configuration +item. \begin{cmdsubsub}{-h, --help}{cl-h} -h, --help @@ -471,7 +465,7 @@ corresponding configuration option. Shows a quick help message (namely a list of command-line options) and exits successfully. -\begin{cmdsubsub}{-V, --version}{cl-v} +\begin{cmdsubsub}{-V, --version}{cl-V} -V, --version \end{cmdsubsub} @@ -482,56 +476,67 @@ Show the current version of the program and exits successfully. \end{cmdsubsub} Shows the list of the configuration files for the current installation and -platform, with their status (active or not found) and a star marking the -recommended file for user settings. +platform, with their status (active, not found, or disabled +(see~\ref{cf-lastfile_switch})) and exits successfully. -\begin{cmdsubsub}{-w, -l, -m, -s, -r, --view, --list, --mixed, --search, +\begin{cmdsubsub}{-w, -l, -m, -s, -r, --view, --list, --mixed, --showall, --regex}{cl-mode} - -w, --view, -l, --list, -m, --mixed, -s, --search, -r, --regex + -w, --view, -l, --list, -m, --mixed, -s, --showall, -r, --regex \end{cmdsubsub} -See~\ref{cf-mode}. +\hfill Set ©mode© to the given value, see~\ref{cf-mode}. \begin{cmdsubsub}{-a, -A, --alias, --noalias}{cl-a} -a, --alias, -A, --noalias \end{cmdsubsub} -See~\ref{s-alias}. +Set ©alias_switch© true (resp. false), see~\ref{cf-alias_switch} \begin{cmdsubsub}{-i, -I, --interact, --nointeract}{cl-i} -i, --interact, -I, --nointeract \end{cmdsubsub} -See~\ref{cf-interact}. +Set ©interact_switch© to true (resp. false), see~\ref{cf-interact_switch}. \begin{cmdsubsub}{-e, --extensions}{cl-e} -e=«l», --extensions=«l» \end{cmdsubsub} -See~\ref{cf-ext_list}. \emph{But} be aware that on the command line there -should be no space at all, neither in the list (unless quoted according to you -shell's convention) not between the ©-e© or ©--extension© option, the equal -sign, and the list. Also take care to quote the special value ©*© if -necessary. The equal sign is optional. +Set ©ext_list©, see~\ref{cf-ext_list}. \textbf{Warning}: this command-line +option is deprecated and will likely be removed soon. It is recommended to set +©ext_list© in a configuration file instead. Please protest on the \tdml if you +want to keep this command-line option. + +\begin{cmdsubsub}{-v, --verbosity}{cl-v} + -v=«n», --verbosity=«n» +\end{cmdsubsub} + +Set ©verbosity_level© to ©«n»©, see~\ref{cf-verbosity_level}. Be aware that you +must avoid spaces on the command line, and the ©=© sign is optional. + +\begin{cmdsubsub}{-d, --debug}{cl-d} + -d, -d=«list», --debug, --debug=«list» +\end{cmdsubsub} + +Set ©debug_list©, see~\ref{cf-debug_list}. If not list is given, activates all +available debug items. -\begin{cmdsubsub}{-v, --verbosity, -d, --debug}{cl-n} - -v=«n», --verbosity=«n», -d, --debug +\begin{cmdsubsub}{-M, --machine}{cl-M} + -M, --machine \end{cmdsubsub} -See~\ref{cf-verbosity_level} and be aware that you must avoid spaces on the -command line, and the ©=© sign is optional. The ©--debug© option sets -verbosity at the maximum level. +Set ©machine_switch© to true, see~\ref{cf-machine_switch}. \subsection{Environment variables}\label{ss-envvar} They all correspond to some ©viewer_«ext»© setting, and the reader is referred -to~\ref{s-viewer} and~\ref{cf-viewer_*} for details. Also, environment -variables used by older versions of \texdoc are accepted. You can append -©_texdoc© to every name in the first column: this wins over every other name. +to~\ref{cf-viewer_*} for details. Also, environment variables used by older +versions of \texdoc are accepted. You can append ©_texdoc© to every name in +the first column: this wins over every other name. \begin{center} - \begin{tabular}{@{}l*3{@{ }l}@{}} - New name & Old name 1 & Old name 2 & Config. param.\\ + \begin{tabular}{*4l} + New name & Old name 1 & Old name 2 & Config. item\\ ©PAGER© & ©TEXDOCVIEW_txt© & ©TEXDOC_VIEWER_TXT© & ©viewer_txt© \\ ©BROWSER© & ©TEXDOCVIEW_html© & ©TEXDOC_VIEWER_HTML© & ©viewer_html© \\ ©DVIVIEWER© & ©TEXDOCVIEW_dvi© & ©TEXDOC_VIEWER_DVI© & ©viewer_dvi© \\ @@ -540,69 +545,69 @@ variables used by older versions of \texdoc are accepted. You can append \end{tabular} \end{center} -\subsection{Configuration files}\label{ss-conf} +\subsection{Configuration items}\label{ss-conf} -\subsubsection{General structure}\label{sss-sonf-struct} +\subsubsection{Structure of configuration files}\label{sss-sonf-struct} Configuration files are line-oriented text files. Comments begin with a ©#© and run to the end of line. Lines containing only space are ignored. Space at the beginning or end of a line, as well as around an ©=© sign, is ignored. Apart from comments and empty lines, each line must be of one of the following -forms: +forms. \begin{htcode} - «config_param» = «value» - alias «name» = «target» + «configuration item» = «value» + alias «original keyword» = «name» + alias(«score») «original keyword» = «name» + stopalias «original keyword» + adjscore «pattern» = «score adjustment» + adjscore(«keyword») «pattern» = «score adjustment» \end{htcode} -where ©«config_parameter»© consists of only letters, digits or ©-© signs, -©«name»© of letters, digits, ©-© and ©_© signs. ©«value»© and ©«target»© are -free strings (except that not every ©«value»© is valid for every -©«config_param»©, see below) and nothing in it need not be quoted (actually, -quotes will be interpreted as part of the value, not as quotation marks). +We will concentrate on the ©«configuration item»© part here, since other +directives have already been presented (\ref{ss-alias} and \ref{ss-score}). -Lines which do not obey these rules raise a warning. However, unrecognised -values of ©«config_param»© raise no warning at the moment. +In the above, ©«value»© never needs to be quoted: quotes would be interpreted +as part of the value, not as quotation marks (this also holds for the other +directives). -The ©«value»© is usually interpreted as a string, except when ©«config_param»© -ends with: +Lines which do not obey these rules raise a warning, as well as unrecognised +values of ©«configuration item»©. The ©«value»© can be an arbitrary string, +except when the name of the ©«configuration item»© ends with: \begin{enumerate} \item ©_list©, then ©«value»© is a coma-separated list of strings. Space around commas is ignored. Two consecutive comas or a coma at the beginning or end of the list means the empty string at the corresponding place. \item ©_switch©, then ©«value»© must be either ©true© or ©false© - (case-sensitive). - \item ©_level©, then ©«value»© is a non-negative integer. + (lowercase). + \item ©_level©, then ©«value»© is an integer. \end{enumerate} +In these cases, an improper ©«value»© will raise a warning too. \begin{cmdsubsub}{mode}{cf-mode} - mode = «view, list, mixed, search, regex» + mode = «view, list, mixed, showall, regex» \end{cmdsubsub} -Set the mode to the given value. Default is ©view©. The first three values -©view©, ©list©, ©mixed© use the same searching method: first search a file -whose name is the ©«name»© on the command line and whose extension is in -©ext_list© (see~\ref{cf-ext_list}), and if nothing is found, then do a full -search. This means that a file matches if ©«name»© is a substring of its -path+name (and its extension is in the list). Here path does not mean the full -path, but only the part below ©TEXMF/doc©. The ©search© mode forces a full -search. - -The last mode, ©regex©, looks for ©«name»© in the path+filename as a Lua -regex. If you don't know Lua regexes you should be aware that the escape -character is ©%© and the ©-© sign is a special character (which means the same -as ©*?© in Perl regexes). For more details, see the Lua -\href{http://www.lua.org/manual/}{reference manual} or the book -\href{http://www.lua.org/pil/}{\emph{programming in Lua}}. You might want to -use\footnote{The quotes in the example are just to make the shell happy.} -©-e='*'© if your regex uses the ©$© anchor.%stopzone - -\begin{cmdsubsub}{interact}{cf-interact} +Set the mode to the given value. Default is ©view©. All mode except regex +have been presented in~\ref{ss-modes}. + +In regex mode, the given name is interpreted as a Lua regex, and only files +whose full name (including path) matches it are found. Alias and score +mechanisms are disabled. \textbf{Warning}: this mode is deprecated and will +likely be removed soon. Please protest on the \tdml if you want it to stay. + +\begin{cmdsubsub}{interact}{cf-interact_switch} interact_switch = «true, false» \end{cmdsubsub} Turn on or off interaction. Default is on. Turning interaction off prevents \texdoc to ask you to choose a file to view when there are multiple choices, -and merely just print the list of files found. +so it just prints the list of files found. + +\begin{cmdsubsub}{alias}{cf-alias_switch} + alias_switch = «true, false» +\end{cmdsubsub} + +Turn on or off aliasing. Default is on. \begin{cmdsubsub}{ext_list}{cf-ext_list} ext_list = «list» @@ -612,8 +617,9 @@ Set the list of recognised extensions to ©«list»©. Default is \begin{htcode} pdf, html, txt, dvi, ps, \end{htcode} -This list is used to filter and sort the results (with the default value: pdf -first, etc). Two special values are recognised: +This list is used to filter and sort the results that have the same +score(with the default value: pdf first, etc). Two special values are +recognised: \begin{itemize} \item \emph{The empty element}. This means files without extensions, or more precisely without a dot in their name. This is meant for files like @@ -624,7 +630,7 @@ first, etc). Two special values are recognised: There is a very special case: if the searched ©«name»© has ©.sty© extension, \texdoc enters a special search mode for ©.sty© files (not located in the same -place as real documentation files) for this ©«name»©, independantly of the +place as real documentation files) for this ©«name»©, indepandantly of the current value of ©ext_list© and ©mode© (unless it is the ©regex© mode). In an ideal world, this wouldn't be necessary since every sty file would have a proper documentation in pdf, html or plain text, but\dots @@ -635,93 +641,81 @@ For each ©«ext»© in ©ext_list© there should be a corresponding \texdoc to be able to find man pages and display them with the ©man© command, you can use \begin{htcode} - ext_list = 1, 5, pdf, html, txt, dvi, ps, + ext_list = pdf, html, 1, 5, txt, dvi, ps, viewer_1 = man viewer_5 = man \end{htcode} -(This also makes man pages in man format take precedence over their pdf -versions.) + +\begin{cmdsubsub}{badext_list}{cf-badext_list} + badext_list = «list» +\end{cmdsubsub} + +Set the list of ``bad'' extensions to ©«list»©. Default is ``©txt,©''. Files +with those extensions get a heuristic score of 0. \begin{cmdsubsub}{viewer_*}{cf-viewer_*} viewer_«ext» = «cmd» \end{cmdsubsub} Set the viewer command for files with extension ©«ext»© to ©«cmd»©. For files -without extension, ©viewer_txt© is used, and there's not ©viewer_© variable. +without extension, ©viewer_txt© is used, and there's no ©viewer_© variable. In ©«cmd»©, ©%s© can be used as a placeholder for the file name, which is otherwise inserted at the end of the command. The command can be a arbitrary shell construct. -\begin{cmdsubsub}{alias}{cf-alias} - alias «name» = «othername» +\begin{cmdsubsub}{verbosity_level}{cf-verbosity_level} + verbosity_level = «n» \end{cmdsubsub} -Everything has already been said in section~\ref{s-alias}. +Set the verbosity level to ©«n»©. 3 means errors, warnings and informational +message will be printed (on stdout); 2 means only errors and warnings, 1 only +errors and 0 nothing (not recommended). -\begin{cmdsubsub}{verbosity_level}{cf-verbosity_level} - verbosity_level = «n» +\begin{cmdsubsub}{debug_list}{cf-debug_list} + debug_list = «list» \end{cmdsubsub} -Set the verbosity level to ©«n»©. This determines whether \texdoc will print -or not errors or debug information (to stderr). Default level is 3. The -numeric codes are as follow: -\begin{enumerate}[start=0] - \item Print nothing (not recommended). - \item Print only error messages. - \item Also print warnings. - \item Also print information messages. - \item[n] Also print debug(n-3) information messages. -\end{enumerate} +Set the list of activated debug items (default: none). For a list of available +items, see the source code, file ©constants.tlu©, variable ©known_debugs©. +Debug information is printed on standard error. + +\begin{cmdsubsub}{machine_switch}{cf-machine_switch} + machine_switch = «true, false» +\end{cmdsubsub} -Currently, debug goes from 1 to 3 : ©debug1© prints the command used to view a -file just before executing it, ©debug2© prints information about setting -configuration paramters, and ©debug3© about the search paths used. +Turn on or off machine-readable output (default: off). With this option +active, the value of ©interact_switch© is forced to ©false©, and each line of +output is +\begin{htcode} + «argument»\t«score»\t«filename» +\end{htcode} +where ©«argument»© is the name of the argument to which the results correspond +(mainly useful if there were many arguments), ©\t© is the tab (ascii 9) +character, and the other entries are pretty self-explanatory. Nothing else is +printed on stdout, except if a internal error occurs (in which case exit code +will be 1). In the future, more tab-separated fields may be added at the end +of the line, but the first 3 fields will remain unchanged. \begin{cmdsubsub}{lastfile_switch}{cf-lastfile_switch} lastfile_switch = «true, false» \end{cmdsubsub} -Prevents \texdoc from reading any other configuration file after this one. -Mainly useful for installing a newer version of \texdoc in your home (see the +If set to true, prevents \texdoc from reading any other configuration file +after this one (they will be reported as ``disabled'' by ©texdoc -f©). Mainly +useful for installing a newer version of \texdoc in your home and preventing +the default configuration file from older versions to be used(see the \href{http://tug.org/texdoc/}{web site} for instructions on how to do so). \subsection{Exit codes}\label{ss-exit} -The current exit code are as follow: +The current exit codes are: \begin{enumerate}[start=0] \item Success. - \item Syntax error. - \item Documentation not found for at least one argument. + \item Internal error. + \item Usage error. \end{enumerate} -\section{Bugs, warnings}\label{s-bugs} - -There is currently no known bug (fingers crossed). But a few things you should -be warned about. - -First of all, \texdoc doesn't always succeed in finding documentation (or -finds so many results that it is not useful). Moreover, it cannot handle very -correctly packages with many relevant documentation files at the moment -(see~\ref{ss-alias-rem}). Ideas about how to improve this are most welcome at -the usual address. - -Second, support for zipped documentation, which have been ``available'' in -previous versions of \texdoc, is now disabled by default. The reasons are that -this support wasn't portable (didn't work on windows for example), and -moreover we won't ship compressed documentation in \texlive. However, the -code has not been totally removed and should be easy to activate again. If you -want to use this feature, please: -\begin{enumerate} - \item Look in \texdoc's code for instructions (look for the ©support_zipped© - variable and change it to true). - \item Check that the zip commands in texdoc's default match whatever command - is available on your system. -\end{enumerate} - -Finally, \texdoc is also missing a GUI version (texdoctk has never been the -GUI version of \texdoc, and is unmaintained and probably unmaintainable -anyway). This is on the list, but the time line is rather unclear at the -moment. +\clearpage \section{Licence}\label{s-licence} @@ -752,10 +746,8 @@ Previous work (texdoc program) in the public domain: \end{itemize} \bigskip -\begin{center}\Large\rmfamily +\begin{center}\Large\rmfamily\bfseries Happy \TeX{}ing! \end{center} \end{document} - - |