## Copyright (C) 2013 Júlio Hoffimann ## Copyright (C) 2013 Carnë Draug ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 3 of the License, or (at ## your option) any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, see ## . ## -*- texinfo -*- ## @deftypefn {Command} {} citation ## @deftypefnx {Command} {} citation @var{pkgname} ## @deftypefnx {Function File} {} citation (@var{pkgname}, @var{reference}) ## Display citation to use for GNU Octave or installed package. ## ## ## ## The 2 arguments function is meant for developers. It allows for a package ## to register the displayed @var{reference} for a specific @var{pkgname}. To ## unregister, an empty reference can be used. These should be used in ## conjunction with the @code{PKG_ADD} and @code{PKG_DEL} ## ## @seealso{info, version} ## @end deftypefn function citation (pkgname = "octave", reference) persistent ref_list = struct ("octave", core_reference ()); if (nargin > 2) print_usage(); elseif (! ischar (pkgname)) error ("citation: PKGNAME must be a string"); endif pkgname = tolower (pkgname); if (nargin == 0 || nargin == 1) if (isfield (ref_list, pkgname)) disp (ref_list.(pkgname)); else printf ("No citation found for %s\n", pkgname); endif elseif (nargin == 2) if (! ischar (reference)) error ("citation: REFERENCE to use for package %s must be a string", pkgname); elseif (strcmpi (pkgname, "octave")) error ("citation: not allowed to overwrite citation for GNU Octave"); elseif (isempty (reference)) ref_list = rmfield (ref_list, pkgname); else ref_list.(pkgname) = reference; endif endif endfunction function ref = core_reference ref = "\n... To cite GNU Octave in publications use:\n... \n... John W. Eaton, David Bateman, and Soren Hauberg.\n... Gnu Octave Version 3.0.1 Manual: A High-Level Interactive Language For\n... Numerical Computations. CreateSpace Independent Publishing Platform, 2009.\n... ISBN 1441413006. URL http://www.gnu.org/software/octave/doc/interpreter/.\n... \n... A BibTeX entry for LaTeX users is\n... \n... @book{\n... Author = {John W. Eaton and David Bateman and S\\o ren Hauberg},\n... Title = {Gnu Octave Version 3.0.1 Manual: A High-Level Interactive Language For Numerical Computations},\n... Publisher = {CreateSpace Independent Publishing Platform},\n... Year = {2009},\n... ISBN = {1441413006},\n... URL = {http://www.gnu.org/software/octave/doc/interpreter},\n... }\n... \n... See also `citation pkgname' for citing GNU Octave packages."; endfunction %!assert (~isempty (citation ()))