| 1 |
%% |
| 2 |
%% This is file `fits-astro.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% fits-astro.dtx (with options: `package-tex') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Copyright (C) 2026 Valentin Dao |
| 12 |
%% |
| 13 |
%% This file may be distributed and/or modified under the |
| 14 |
%% conditions of the LaTeX Project Public License, either |
| 15 |
%% version 1.3 of this license or (at your option) any later |
| 16 |
%% version. The latest version of this license is in: |
| 17 |
%% |
| 18 |
%% http://www.latex-project.org/lppl.txt |
| 19 |
%% |
| 20 |
%% and version 1.3c or later is part of all distributions of |
| 21 |
%% LaTeX version 2008-05-04 or later. |
| 22 |
%% |
| 23 |
%% This work has the LPPL maintenance status 'maintained' |
| 24 |
%% and the current maintainer is Valentin Dao ([email protected]). |
| 25 |
%% |
| 26 |
%% This work consists of the files fits-astro.ins, fits-astro.dtx, along with the derived files fits-astro.tex, fits-astro.sty and fits-astro-en.pdf |
| 27 |
%% |
| 28 |
%% The repository of this work can be found at: |
| 29 |
%% |
| 30 |
%% https://github.com/ankaa3908/fitsheader |
| 31 |
%% |
| 32 |
\ifdefined\loadheader\expandafter\endinput\fi |
| 33 |
|
| 34 |
\def\FITSerr#1{\errmessage{Package fits Error: #1}} |
| 35 |
\def\FITSwar#1{\message{Package fits Warning: #1}} |
| 36 |
|
| 37 |
\unless\ifdefined\directlua |
| 38 |
\FITSerr{LuaTeX required} |
| 39 |
\fi |
| 40 |
|
| 41 |
\directlua{dofile('fits-astro.lua')} |
| 42 |
|
| 43 |
\def\loadheader#1#2{ |
| 44 |
\directlua{ |
| 45 |
local key = '\csstring#1' |
| 46 |
if FITS_data[key] then |
| 47 |
tex.print('\luaescapestring{\FITSerr{FITS file '#2' already loaded}}') |
| 48 |
else |
| 49 |
FITS_data[key] = load_fits('#2') |
| 50 |
end |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
\def\showheader#1{ |
| 55 |
\directlua{ |
| 56 |
show_fits(FITS_data['\csstring#1']) |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
\def\headerkey#1#2{ |
| 61 |
\directlua{ |
| 62 |
if FITS_data['\csstring#1']['#2'] then |
| 63 |
get_header_key(FITS_data['\csstring#1'], '#2') |
| 64 |
else |
| 65 |
tex.print('\luaescapestring{\FITSwar{Header key '#2' not found}}') |
| 66 |
end |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
\def\setheaderkey#1#2#3{ |
| 71 |
\directlua{ |
| 72 |
if FITS_data['\csstring#1']['#2'] then |
| 73 |
token.set_macro('\csstring#3', FITS_data['\csstring#1']['#2']) |
| 74 |
end |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
\def\gsetheaderkey#1#2#3{ |
| 79 |
\directlua{ |
| 80 |
if FITS_data['\csstring#1']['#2'] then |
| 81 |
token.set_macro('\csstring#3', FITS_data['\csstring#1']['#2'], 'global') |
| 82 |
end |
| 83 |
} |
| 84 |
} |
| 85 |
\endinput |
| 86 |
%% |
| 87 |
%% End of file `fits-astro.tex'. |