Skip to content
Snippets Groups Projects
Commit f766c5ae authored by John Swinbank's avatar John Swinbank
Browse files

Import proceedings template

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1080 additions and 0 deletions
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ourVersions">
<value>
<list size="3">
<item index="0" class="java.lang.String" itemvalue="3.6" />
<item index="1" class="java.lang.String" itemvalue="3.7" />
<item index="2" class="java.lang.String" itemvalue="3.8" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="eventio" />
<item index="1" class="java.lang.String" itemvalue="ctaplot" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (base)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ADASS2020_author_template.iml" filepath="$PROJECT_DIR$/.idea/ADASS2020_author_template.iml" />
</modules>
</component>
</project>
\ No newline at end of file
% This is the ADASS_template.tex LaTeX file, 19th Sep 2019.
% It is based on the ASP general author template file, but modified to reflect the specific
% requirements of the ADASS proceedings.
% Copyright 2014, Astronomical Society of the Pacific Conference Series
% Revision: 14 August 2014
% To compile, at the command line positioned at this folder, type:
% latex ADASS_template
% latex ADASS_template
% dvipdfm ADASS_template
% This will create a file called ADASS_template.pdf
\documentclass[11pt,twoside]{article}
% Do NOT use ANY packages other than asp2014.
\usepackage{asp2014}
\aspSuppressVolSlug
\resetcounters
% References must all use BibTeX entries in a .bibfile.
% References must be cited in the text using \citet{} or \citep{}.
% Do not use \cite{}.
% See ManuscriptInstructions.pdf for more details
\bibliographystyle{asp2014}
% The ``markboth'' line sets up the running heads for the paper.
% 1 author: "Surname"
% 2 authors: "Surname1 and Surname2"
% 3 authors: "Surname1, Surname2, and Surname3"
% >3 authors: "Surname1 et al."
% Replace ``Short Title'' with the actual paper title, shortened if necessary.
% Use mixed case type for the shortened title
% Ensure shortened title does not cause an overfull hbox LaTeX error
% See ASPmanual2010.pdf 2.1.4 and ManuscriptInstructions.pdf for more details
\markboth{Author1, Author2, and Author3}{Short Title}
\begin{document}
\title{ADASS Author Template and Long Title}
% Note the position of the comma between the author name and the
% affiliation number.
% Authors surnames should come after first names or initials, eg John Smith, or J. Smith.
% Author names should be separated by commas.
% The final author should be preceded by "and".
% Affiliations should not be repeated across multiple \affil commands. If several
% authors share an affiliation this should be in a single \affil which can then
% be referenced for several author names. If only one affiliation, no footnotes are needed.
% See ManuscriptInstructions.pdf and ASP's manual2010.pdf 3.1.4 for more details
\author{Sample~Author1,$^1$ Sample~Author2,$^2$ and Sample~Author3$^2$}
\affil{$^1$Institution Name, Institution City, State/Province, Country; \email{AuthorEmail@email.edu}}
\affil{$^2$Institution Name, Institution City, State/Province, Country}
% This section is for ADS Processing. There must be one line per author. paperauthor has 9 arguments.
\paperauthor{Sample~Author1}{Author1Email@email.edu}{ORCID_Or_Blank}{Author1 Institution}{Author1 Department}{City}{State/Province}{Postal Code}{Country}
\paperauthor{Sample~Author2}{Author2Email@email.edu}{ORCID_Or_Blank}{Author2 Institution}{Author2 Department}{City}{State/Province}{Postal Code}{Country}
\paperauthor{Sample~Author3}{Author3Email@email.edu}{ORCID_Or_Blank}{Author3 Institution}{Author3 Department}{City}{State/Province}{Postal Code}{Country}
% There should be one \aindex line (commented out) for each author. These are used to
% build up the author index for the Proceedings. The surname must come first, followed by
% initials. Note the use of ~ before each initial to control spacing.
% The \author entries (see above) have surname last. These \aindex entries have
% surname first.
% The Aindex.py command willl create them for you after you have constructed the \author
% The first entry should be the first author, for bold-facing the author index page-reference
%\aindex{FistAuthor1,~S.~A.}
%\aindex{Author2,~S.~B.}
%\aindex{Author3,~S.}
\begin{abstract}
This is the ADASS 2019 author template file. This is based on the Astronomical Society of the Pacific (ASP) 2014 template,
but has been modified to reflect the specific ADASS requirements.
\end{abstract}
% These lines show examples of subject index entries. At this stage these have to commented
% out, and need to be on separate lines. Eventually, they will be automatically uncommented
% and used to generate entries in the Subject Index at the end of the Proceedings volume.
% Don't leave these in! - replace them with ones relevant to your paper.
%\ssindex{FOOBAR!conference!ADASS 2019}
%\ssindex{FOOBAR!organisations!ASP}
% These lines show examples of ASCL index entries. At this stage these have to commented
% out, and need to be on separate lines. Eventually, they will be automatically uncommented
% and used to generate entries in the ASCL Index at the end of the Proceedings volume.
% The ascl.py command will scan your paper on possible code names.
% Don't leave these in! - replace them with ones relevant to your paper.
%\ooindex{FOOBAR, ascl:1101.010}
\section{The Template}
To fill in this template, make sure that you read and follow the ASPCS Instructions for Authors and Editors available for download online. Further hints and tips for including graphics, tables, citations, and other formatting helps are available there. With this template, you should have received a copy of the specific ADASS manuscript instructions, and you should also read these.
\subsection{The Author Checklist}
The following checklist should be followed when writing a submission to a conference proceedings to be published by the ASP for ADASS. The references are to sections in the ADASS manuscript instructions.\footnote{Most URLs should be in a footnote like this one. In this case, you can download the online material from \url{http://www.adass.org}.}
\begin{itemize}
\checklistitemize
\item References must all use BibTeX entries in a .bib file. No use of \verb"\bibitem"! (Even though some older ASP templates have them.) (See References.)
\item All references must be cited in the text, usually using \verb"\citet" or \verb"\citep". Do not use \verb"\cite". (See References.)
\item No LaTeX warnings. Particularly, no overfull hboxes or unresolved references. (See LaTeX warnings and errors.)
\item No use of \verb"\usepackage" except for \verb"\usepackage{asp2014}". (See LaTeX packages and commands.)
\item No use of \verb"\renewcommand" or \verb"\renewenvironment". (See LaTeX packages and commands.)
\item Arguments to \verb"\citep" etc., should use ADS type references where possible, fall back on <author><year> or something suitably unique if not. (See References.)
\item References in the text are all generated automatically (using \verb"\citep" etc), not put in explicitly as ordinary text that just looks like a generated reference. (See References.)
\item Definitely no LaTeX errors. (See LaTeX warnings and errors.)
\item Paper is the right length. References don't spill over into one more page. (See Length of Paper.)
\item Paper has an abstract. (See Length of Paper.)
\item References are to things that actually exist and can be expected to continue to exist. Not papers ``in preparation'' or URLs for blog items. (See References.)
\item Graphics files have to be .eps encapsulated Postscript format. Yes they do! Sorry, but they do. (See Figures.)
\item Name all the files properly:- figures are <paper>\_f<n>.eps, eg O1-3\_f1.eps. Paper names use dashes not periods, O1-3.tex not O1.3.tex. Posters now use the same naming convention as oral papers, e.g.\ X3-21. (See File names and Paper IDs.)
\item Figure captions should make sense if the figure is printed in monochrome - because it will be! (See Figures.)
\item Figures are legible at the size ADASS Proceedings volumes are printed, which is quite small. (See Figures.)
\item Copyright forms signed and filled out - don't use electronic signatures. (See Miscellany.)
\item Author lists follow the correct format: comma separated, with an `and' for the final author. (See Authors and Affiliations.)
\item The first author of the paper must be the person who presented the paper at the conference. (See Authors and Affiliations.)
\item No repetition of affiliations - list each organisation once, with multiple e-mail addresses if you really must. (See Authors and Affiliations.)
\item Running heads should fit in the same horizontal space as the text does, not pushing the page numbers over to the right. (See LaTeX warnings and errors.)
\item Run through a spelling checker. (I know that can be tricky with LaTeX.) (See Content and Typesetting.)
\item Proofread, or have the text proofread, to check for proper English usage. In particular, note that ``allows to'' is not conventional English, and English uses articles (`a',`an',`the') in places where other languages, particularly Eastern European languages, don't have them. (See Content and Typesetting.)
\end{itemize}
\section{Text}
Sometimes you just need to have different styles of fonts. \emph{Sometimes you just need to have different styles of fonts.} \textbf{Sometimes you just need to have different styles of fonts.}
Sometimes you just need to have different sizes of fonts. {\small Sometimes you just need to have different sizes of fonts.} {\footnotesize Sometimes you just need to have different sizes of fonts.} It would be very rare to require larger fonts within an ASP volume.
Do \emph{not} reduce the size of the main text font to try to squeeze more content into the paper. It will be restored by the editors and the paper will be rejected as too long.
\section{Math}
Sometimes authors include formulas inside the main text which should always be enclosed within \$ signs. Look at the Pythagorean Formula $a^2 + b^2 = c^2$.
Sometimes authors include formulas on their own lines. This example uses the \verb"displaymath" environment which does not include an equation number. To include an equation number, use the \verb"equation" environment.
\begin{displaymath}
c = \sqrt{a^2 + b^2} \qquad \textrm{Pythagorean Theorem}
\end{displaymath}
\section{Table}
Here is an example table that has three colums with various justification and row spacing.
\begin{table}[!ht]
\caption{Tables in \LaTeXe}
\smallskip
\begin{center}
{\small
\begin{tabular}{llc} % l = left, c = centered
\tableline
\noalign{\smallskip}
First Column & Second Column & Third Column:\\
\noalign{\smallskip}
\tableline
\noalign{\smallskip}
First Row, First Column & First Row, Second Column & First Row, Third Column \\
Second Row, First Column & Second Row, Second Column & Second Row, Third Column \\
Third Row, First Column & Third Row, Second Column & Third Row, Third Column \\
\noalign{\smallskip}
\tableline % Sometimes you just need a line between table rows
\noalign{\smallskip}
Fourth Row, First Column & ~ & Fourth Row, Third Column \\ % Sometimes you have empty cells
\noalign{\smallskip} % Sometimes you just need space between table rows
Fifth Row First Column & Fifth Row, Second Column & Fifth Row, Third Column\\ % No \\ if the last row
\noalign{\smallskip}
\tableline\
\end{tabular}
}
\end{center}
\end{table}
\noindent These tables can get a little messy, but this format is the most common.
\section{Lists}
\label{ex_lists}
There are a lot of ways to make lists including itemized lists with bullets, for which you use (\verb"\begin{itemize}"), numbered lists (\verb"\begin{enumerate}"), and description lists (\verb"\begin{description}"). This is an example of an itemized list.
\subsection{Itemized Lists}
Here is an itemized list:
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\section{Images}
For some figures, see Figures \ref{ex_fig1}- \ref{ex_fig3}.
\articlefigure{example.eps}{ex_fig1}{Welcome to 1953.}
% It is possible to reduce the size of a figure among other changes (see the instructions). Here is an example:
% \articlefigure[width=.5\textwidth]{example.eps}{ex_fig1_reduced}{Welcome to 1953 a little smaller.}
\articlefiguretwo{example.eps}{example.eps}{ex_fig2}{Now there are two of them. \emph{Left:} An image from long ago. \emph{Right:} The same exact thing.}
% There is a figure command allowing for three figures:
% \articlefigurethree{example.eps}{example.eps}{example.eps}{ex_fig1_triple}{Now there are three of them.}
\articlefigurefour{example.eps}{example.eps}{example.eps}{example.eps}{ex_fig3}{Now four of them?}
\clearpage % To force this stuff to happen by this point in the text, otherwise these will probably end up after the references.
There are also the landscape versions \verb"\articlelandscapefigure" and \\
\verb"\articlelandscapefiguretwo" which are further described in the instructions.
\section{References}
References must be provided in BibTeX format, in a .bib file, and should usually be referenced using \verb"\citet" or \verb"\citep". The file example.bib supplied with this template is taken from an ADASS 2015 paper, and includes references to previous ADASS proceedings
\citep[such as][]{1999ASPC..172..487P} and to papers in what was then the current 2015 proceedings (e.g.\ \citet{O11-4_adassxxv}). Note that the `TBD' entries that appear for papers in the current proceedings will be dealt with by the ADASS editors when the final volume is produced. The example .bib file has a large number of references unused by this template file; such unused references have been left in as an example, but should be removed before a paper is submitted.
\section{Conference Photographs}
At the end of this template you may find a commented line with the bookpartphoto where the editors could decided to add a conference photo,
might there be enough room at the end of your paper. Leave this comment in, do not supply your own photos in this paper but contact the editors
if you have some interesting shots.
\acknowledgements The ASP would like to thank the dedicated researchers who are publishing with the ASP. It will make things a lot easier if you keep this text on the same line as the \verb"\acknowledgements" command. Place it just before the bibliography. It's optional of course.
\bibliography{example} % For BibTex
% if we have space left, we might add a conference photograph here. Leave commented for now.
% \bookpartphoto[width=1.0\textwidth]{foobar.eps}{FooBar Photo (Photo: Any Photographer)}
\end{document}
This diff is collapsed.
#
# A d a s s C o n f i g . p y
#
# This is the code for a module that contains a number of utility routines
# that handle configuratrion setting for the various utility programs that
# are used in processing the papers submitted for ADASS Proceedings.
#
# MainSubjectIndexFile ()
# Returns the path to the main subject index file.
#
# If the configuration file exists, it is called ADASS_Configuration and
# is in the user's home directory. This file has a simple format: each line
# is a pair of strings, an entry name and a value for that entry, separated
# by one or more spaces. Strings with spaces can be quoted, using either
# 'single' or "double" quotes. Anything on the line following the second
# string is taken as a comment. Blank lines, and lines where the first non-
# blank character is '#', are ignored. Note that it is possible for the value
# of an entry to be an empty string, specified in the file as "".
#
# Author(s): Keith Shortridge (keith@knaveandvarlet.com.au)
#
# History:
# 17th Jan 2017. Original version. KS.
# 18th Aug 2017. Converted to run under Python3, using 2to3. Added
# the importing of items from __future__ to allow this to
# run under either Python2 or Python3. (Actually, 2to3
# made no changes, but the import from __future__ was put
# in anyway, in case it turns out to be needed later.) KS.
# 19th Aug 2017. Added NewSubjectIndexLocation(). KS.
# 22nd Nov 2017. Added AspDirectory(). KS.
#
# Python versions:
# This code should run under either python 2 or python 3, so long as
# the python 2 version supports the "from __future__ import" used here.
# It has been tested under 2.7 and 3.6.
#
from __future__ import (print_function,division,absolute_import)
import sys
import string
import os
import shlex
_AdassConfigDict = {}
_AdassConfigFileTried = False
_AdassConfigDir = "~"
_AdassConfigFile = "ADASS_Configuration"
# ------------------------------------------------------------------------------
# L o a d C o n f i g E n t r i e s
#
# This routine makes sure that any definitions in the user's ADASS
# configuration file (if it exists) have been read into _AdassConfigDict.
# The first time this is called, it tries to read the entries into the file.
# On subsequent calls, it doesn't - so if the file has changed, or appeared,
# since that first call, this will be missed. It only tries to read the file
# once.
def LoadConfigEntries (Details = None) :
global _AdassConfigFileTried # Needed because this routine 'updates' it
# The first time this routine is called, it tries to open the configuration
# file and read the entries from it. This code ignores blank lines and
# comment lines (lines where the first non-blank character is '#') and
# uses shlex.split() to handle quoted strings properly. All entries and
# their values are set into _AdassConfigDict.
if (not _AdassConfigFileTried) :
_AdassConfigFileTried = True
if (ConfigFileExists(Details)) :
HomeDir = os.path.expanduser(_AdassConfigDir)
ConfigFileName = os.path.join(HomeDir,_AdassConfigFile)
ConfigFile = open(ConfigFileName,"r")
for Line in ConfigFile :
Line = Line.strip(" \r\n")
if (Line != "") :
if (not Line.startswith('#')) :
Entries = shlex.split(Line)
if (len(Entries) >= 2) :
_AdassConfigDict[Entries[0]] = Entries[1]
# ------------------------------------------------------------------------------
# C o n f i g F i l e E x i s t s
#
# Returns true if the ADASS configuration file exists, false otherwise. If
# Details is supplied, it should be a list of strings, to which this routine
# will add details of the file and whether it could be found.
def ConfigFileExists(Details = None) :
Exists = False
Log = (Details != None)
HomeDir = os.path.expanduser(_AdassConfigDir)
ConfigFileName = os.path.join(HomeDir,_AdassConfigFile)
if (os.path.exists(ConfigFileName)) : Exists = True
if (Log) :
if (Exists) :
Details.append("Configuration file is " + _AdassConfigFile + " in " + \
HomeDir)
else :
Details.append("Configuration file should be " + _AdassConfigFile + \
" in " + HomeDir)
Details.append("but this file does not exist")
return Exists
# ------------------------------------------------------------------------------
# L o o k u p C o n f i g E n t r y
#
# Returns the value of a named entry in the user's ADASS configuration file,
# if possible. If the file cannot be opened, or if the specified entry has
# not been defined in it, this routine returns None. The optional
# Details argument is a list of strings to which this appends a description
# of its results.
def LookupConfigEntry (EntryName,Details = None) :
LoadConfigEntries(Details)
# Assuming we've read the configuration file entries into the dictionary,
# if possible, look up the entry in there, returning None if it's missing.
Value = _AdassConfigDict.get(EntryName,None)
# If the entry isn't defined, this may be because the configuration file
# doesn't exist, or becasue it didn't have the entry we were looking for.
if (Details != None) :
if (Value == None) :
if (ConfigFileExists()) :
Details.append(EntryName + \
" is not defined in the configuration file")
else :
Details.append("No configuration file: Cannot look up " + EntryName)
else :
Details.append(EntryName + " is defined as '" + Value + \
"' in the configuration file")
return Value
# ------------------------------------------------------------------------------
# L o c a t e F i l e
#
# This is a general-purpose file finding routine. It is passed the name of
# a configuration item that should define the file location in the main
# ADASS configuration file. It looks up that item and looks for the file
# it specifies. If it fails to find the configuration file, or the item,
# it will look for the file using the name passed, first in the default
# directory, then in a set of other directories passed as a list. The optional
# Details argument is a list of strings to which this appends a description
# of the steps it took and the results.
def LocateFile (Description,ConfigEntryName,FileName,DirectoryList,\
Details = None) :
Path = ""
# Most of the code in this routine is to do with logging the details.
# But I think that can be useful, particularly if the file can't be found.
Log = False
if (Details != None) : Log = True
if (Log) :
Details.append("Looking for " + Description)
# If there is a specification for this file in the main ADASS configuration
# file, we should use it, and we should expect the specified file to exist.
# LookupConfigEntry() itself will fill in Details if the config file
# doesn't exist or if it doesn't have the entry defined.
ConfigPath = LookupConfigEntry(ConfigEntryName,Details)
if (ConfigPath != None and ConfigPath != "") :
if (ConfigPath.startswith('~')) :
ConfigPath = os.path.expanduser(ConfigPath)
if (os.path.exists(ConfigPath)) :
Path = ConfigPath
if (Log) :
Details.append( \
"The file specified in the configuration file exists")
else :
if (Log) :
Details.append( \
"The file specified in the configuration file does not exist")
if (Path == "") :
# If we can't find an entry in a configuration file, see if there
# is a file in the default directory.
if (Log) :
Details.append("Will look in specific locations for the file.")
if (os.path.exists(FileName)) :
Path = FileName
if (Log) : Details.append("Using file found in default directory")
if (Path == "") :
# If we can't find a file in the default directory, work through the
# various other directories passed in the directory list.
if (Log) :
Details.append(FileName + " not found in the default directory")
for Dir in DirectoryList :
DirFileName = os.path.join(Dir,FileName)
if (os.path.exists(DirFileName)) :
if (Log) :
Details.append("Using file found in " + Dir + " directory")
Path = DirFileName
break
else :
if (Log) :
Details.append( \
FileName + " not found in " + Dir + " directory")
if (Path == "" and Log) :
Details.append("Cannot locate " + Description)
return Path
# ------------------------------------------------------------------------------
# M a i n S u b j e c t I n d e x F i l e
#
# This routine returns a path to the main subject index file. This is a file
# containing the various subject index topics that have been used for
# previous ADASS conferences, in an alphabetical hierarchical format. (For
# more details about subject index file formats see the comments to the
# AdassIndex.py module.) It may be that during the course of editing of a
# new Proceedings volume, this file is updated from time to time.
# Alternatively, it may be supplemented by a 'new' subject index file,
# containing new entries used for the current conference.
#
# This routine looks in various places for such a file.
# If no such file can be found, an empty string is returned. Note that if
# a non-empty string is returned, this is the pathname of a file that exists.
# An optional Details list can be passed. If so, this routine appends to it a
# set of strings describing its progress and where it looked for the file.
# This gives the caller the option of printing these out if the file cannot be
# found.
def MainSubjectIndexFile (Details = None) :
# For historical reasons, we fall back on looking in a Work sub-directory
# for the file - this is where it was for the Sydney ADASS processing.
Path = LocateFile ("main subject index file","MainSubjectIndexFile", \
"subjectKeywords.txt",["Work"],Details)
return Path
# ------------------------------------------------------------------------------
# N e w S u b j e c t I n d e x F i l e
#
# This routine returns a path to the new subject index file. This is a file
# containing the various subject index topics that have been used for
# papers in the current volume, in an alphabetical hierarchical format, with
# a separate section for each paper. (For more details about subject index file
# formats see the comments to the AdassIndex.py module.)
#
# This routine looks in various places for such a file. If an existing file
# can be found, this will be used. However, especially at the start of the
# editing process for a new volume, such a file may not exist and a new
# one will have to be created. If no file is found in the expected places,
# but there is a file name defined in the configuration file, this routine
# will return that configuration file name. An emptry string will be returned
# if no existing file can be found and there was no specification given in
# the configuration file.
#
# An optional Details list can be passed. If so, this routine appends to it a
# set of strings describing its progress and where it looked for the file.
# This gives the caller the option of printing these out if the file cannot be
# found.
def NewSubjectIndexFile (Details = None) :
# For historical reasons, we fall back on looking in a Work sub-directory
# for the file - this is where it was for the Sydney ADASS processing.
ConfigEntryName = "NewSubjectIndexFile"
Path = LocateFile ("new subject index file",ConfigEntryName, \
"newKeywords.txt",["Work"],Details)
if (Path == "") :
# Couldn't find an existing file. See if the configuration file gave
# the name for a new file we can create. (We could fall back on
# 'newKeywords.txt' in the default directory, but I don't think we
# should.)
ConfigPath = LookupConfigEntry(ConfigEntryName,Details)
if (ConfigPath != None and ConfigPath != "") :
if (Details != None) :
Details.append("Using file name defined in configuration file")
if (ConfigPath.startswith('~')) :
ConfigPath = os.path.expanduser(ConfigPath)
Path = ConfigPath
else :
if (Details != None) :
Details.append("A configuration file entry is needed to supply" + \
" the file name to use")
return Path
# ------------------------------------------------------------------------------
# N e w S u b j e c t I n d e x L o c a t i o n
#
# This routine returns a description of where this code looks for the new
# subject index file. The idea is that if the user might want to change the
# file used, or if they might be wondering why it can't be found, it would
# be useful to print out a brief summary of the details of its location.
# This routine returns a list of text strings that contain the required
# information.
def NewSubjectIndexLocation () :
Details = []
Details.append("The 'new' subject index file is found as follows:")
HomeDir = os.path.expanduser(_AdassConfigDir)
Details.append("There is normally a configuration file " + \
_AdassConfigFile + " in " + HomeDir)
Details.append("A 'NewSubjectIndexFile' entry in the configuration file" \
" gives the index file location")
Details.append("If this fails, a 'Work/newKeywords.txt' will be used if" \
" this exists")
return Details
# ------------------------------------------------------------------------------
# A s p P i r e c t o r y
#
# This routine returns a path to a directory that contains the asp2014.bst
# and asp2014.sty files needed by an ADASS paper.
#
# This routine looks in various places for these files. It will start by
# looking for them in the current default directory. If it cannot find them
# there it looks in the configuration file for an item called AspDirectory.
# If that defines a directory that contains the asp2014 files, it will
# return that. If it still cannot find the asp2014 files, it will return
# an empty string. If it does find the files, it returns the absolute path
# of the directory that contains them.
#
# An optional Details list can be passed. If so, this routine appends to it a
# set of strings describing its progress and where it looked for the files.
# This gives the caller the option of printing these out if the file cannot be
# found.
def AspDirectory (Details = None) :
Found = False
Directory = os.path.abspath(".")
# Start by looking in the current default directory.
if (os.path.exists("asp2014.sty") and os.path.exists("asp2014.bst")) :
if (Details != None) :
Details.append ("asp2014.sty and asp2014.bst both found in " \
+ Directory)
Found = True
else :
if (Details != None) :
Details.append ("asp2014.sty and asp2014.bst are not both in " \
+ Directory)
# See if we have a configuration specification for AspDirectory
if (Details != None) :
Details.append( \
"Looking for AspDirectory specification in configuration file")
ConfigDetails = []
Directory = LookupConfigEntry("AspDirectory",ConfigDetails)
if (Directory == None or Directory == "") :
if (Details != None) : Details.extend (ConfigDetails)
else :
if (Directory.startswith('~')) :
Directory = os.path.expanduser(Directory)
StyFile = os.path.join(Directory,"asp2014.sty")
BstFile = os.path.join(Directory,"asp2014.bst")
if (os.path.exists(StyFile) and os.path.exists(BstFile)) :
if (Details != None) : Details.append ( \
"asp2014.sty and asp2014.bst both found in " + Directory)
Found = True
else :
if (Details != None) : Details.append ( \
"asp2014.sty and asp2014.bst are not both in " + Directory)
if (not Found) : Directory = ""
return Directory
#
# A d a s s I n d e x . p y
#
# This is the code for a module that contains a number of utility routines
# that handle operations connected with subject index entries for ADASS
# Proceedings.
#
# WriteSubjectIndex (IndexEntries,OutputFile)
# Writes a list of entries in ssindex format to a file in hierarchical
# format.
#
# ReadIndexList (FilePath)
# Reads a file in hierarchical format and returns a list of entries in
# ssindex format.
#
# 'ssindex' format refers to the "topic!sub-topic!sub-topic" form used in
# subject index entries in a .tex file, where the index string is the argument
# to an \ssindex{} command.
#
# 'Hierarchical' format refers to the alphabetical hierarchical format used
# in the text files usually used to record the subject entries used. This
# looks like the way the entries will appear in the volume index, eg:
# topic
# sub-topic
# sub-topic
#
# Author(s): Keith Shortridge (keith@knaveandvarlet.com.au)
#
# Python versions:
# This code is compatible with both Python 2 and Python 3.
#
# History:
# 15th Jan 2017. Original version, based on some code in the Index.py and
# Finish.py ADASS scripts. KS.
# 18th Aug 2017. Added comment about Python 3. KS.
# 11th Oct 2017. Corrected initial comments - duplicate words removed. KS.
import sys
import string
import os
# ------------------------------------------------------------------------------
# W r i t e S u b j e c t I n d e x
#
# This routine is passed a list containing a set of subject entries in the
# "topic!sub-topic!sub-topic" form. They may contain duplicates, and need
# not be sorted. It writes these out in alphabetical hierarchical format, eg
# topic
# sub-topic
# sub-topic
# to the specified file.
#
# Note that what is passed should be an open file, not the name of the file.
# This allows the caller to add additional material - comments, for example -
# before or after the entries written by this routine.
def WriteSubjectIndex (IndexEntries,OutputFile) :
# Writing the output file is easy enough, once we have the entries
# in the list sorted - which sorted() does nicely. We can then spot
# duplicate entries - they'll the same as the previous entry - and
# we can see where the various levels change. We only support three
# levels of entry.
LastEntry = ""
LastTop = ""
LastSecond = ""
Count = 0
for Entry in sorted(IndexEntries) :
if (Entry != LastEntry) :
LastEntry = Entry
Count = Count + 1
Levels = Entry.split("!")
if (Levels[0] != LastTop) :
OutputFile.write(Levels[0] + "\r\n")
LastTop = Levels[0]
LastSecond = ""
if (len(Levels) > 1) :
if (Levels[1] != LastSecond) :
OutputFile.write(" " + Levels[1] + "\r\n")
LastSecond = Levels[1]
if (len(Levels) > 2) :
OutputFile.write(" " + Levels[2] + "\r\n")
# ------------------------------------------------------------------------------
# R e a d I n d e x L i s t
#
# This routine is passed the name of a file containing subject index entries
# in alphabetical hierarchical format, eg
# topic
# sub-topic
# sub-topic
# It reads these and returns a list containing these subject entries in the
# "topic!sub-topic!sub-topic" form. Blank lines and lines beginning with
# '#' are ignored.
#
# Note that if the file does not exist, this routine returns an empty list
# but does not output any error messages. If you need to know if the file
# exists, check this before calling this routine.
def ReadIndexList (FilePath) :
IndexList = []
if (os.path.exists(FilePath)) :
IndexFile = open(FilePath,mode='r')
TopLevel = ""
SecondLevel = ""
for Entry in IndexFile :
if (not Entry.startswith('#')) :
FullEntry = ""
if (Entry.startswith(" ")) :
FullEntry = TopLevel + '!' + SecondLevel + '!' + \
Entry.rstrip(" \r\n").lstrip()
elif (Entry.startswith(" ")) :
SecondLevel = Entry.rstrip(" \r\n").lstrip()
FullEntry = TopLevel + '!' + SecondLevel
else :
if (Entry.strip() != "") :
TopLevel = Entry.rstrip(" \r\n").lstrip()
FullEntry = TopLevel
if (FullEntry != "") :
IndexList.append(FullEntry)
IndexFile.close()
return IndexList
#!/usr/bin/env python
# A i n d e x . p y
#
# A convenience script to help with processing the submissions for the
# Sydney ADASS conference. This reads the main .tex file and prints out
# the list of authors in a form that can be copied and pasted into the
# .tex file as the set of \aindex{} directives needed to generate the
# author index.
#
# Invoke using:
#
# Aindex.py <paper>
#
# where <paper> is the Paper ID, eg O1-4.
#
# (the program could look in the directory and find the main .tex file for
# itself, but having to specify it on the command line serves as a check
# that this is being run in the correct directory).
#
# History:
# 18th Feb 2016. Original version, KS.
# 22nd Sep 2017. Converted to run under Python3, using 2to3. Added
# the importing of items from __future__ to allow this to
# run under either Python2 or Python3. KS.
#
# Python versions:
# This code should run under either python 2 or python 3, so long as
# the python 2 version supports the "from __future__ import" used here.
# It has been tested under 2.7 and 3.6.
#
from __future__ import (print_function,division,absolute_import)
import sys
import string
import AdassChecks
NumberArgs = len(sys.argv)
if (NumberArgs < 2) :
print("Usage: Aindex <paper>")
print("eg: Aindex O1-4")
else :
Paper = sys.argv[1]
Notes = []
print("")
print("Generating author index entries for paper",Paper)
print("")
AuthorList = AdassChecks.GetAuthors (Paper,Notes)
if (len(AuthorList) <= 0) :
print("** No authors found for",Paper,"**")
else :
for Author in AuthorList :
print("%\\aindex{" + Author + "}")
print("")
for Note in Notes :
print("*",Note,"*")
#!/usr/bin/env python
# F i x U n p r i n t a b l e . p y
#
# A convenience script to help with processing the submissions for an
# ADASS conference. This performs the single step of replacing any unprintable
# characters in the main .tex file for a paper with the standard LaTeX
# equivalents. These characters tend to appear when a file is prepared with
# an editor that inserts extended (non-standard ASCII) characters into the
# file to represent accented or other punctuation characters that would
# normally require a more complex LaTeX sequence - for example "\'{e'}" to
# generate an e-acute. The problem is that not all LaTeX installations can
# handle such characters, and it is safer to replace these with the standard
# LaTeX sequences, awkward though they are. A secondary problem is that there
# are a number of possible encodings that can be used, and it is not always
# clear which has in fact been used for any given .tex file.
#
# Usage:
# FixUnprintable filename <encoding>
#
# where filename is the name of the .tex file in question, and encoding is
# an optional argument that can be used to tell the script what encoding
# should be assumed for the file.
#
# If unprintable characters are found in the file, a new version of the file
# will be created in which those unprintable characters that can be fixed
# have been fixed, and the original file is renamed.
#
# The 'encoding' argument can be any of 'ASCII', 'MacRoman', "Latin1" or
# "UTF-8". Case is ignored. If this argument is omitted, the program will
# attempt to determine the encoding automatically. Usually, it will get
# this right. If it cannot determine the encoding, it will ask to be run
# again with the encoding specified explicitly. (There are cases where the
# program is sufficiently confident it knows the encoding, but there is
# some uncertainty. In this case, it will go ahead, but the user may have to
# recover the original file from its renamed version and run the program
# again with the encoding specified explicitly.) In any cases of doubt, the
# program outputs full details of what it found in the file.
#
# Author(s): Keith Shortridge (keith@knaveandvarlet.com.au)
#
# History:
# 15th Jan 2017. Original version.
# 15th Aug 2017. Added automatic determination of encoding, and the use
# of the 'encoding' argument for when this gets the wrong
# answer. KS.
# 23rd Nov 2018. Converted to run under Python3, using 2to3. Added
# the importing of items from __future__ to allow this to
# run under either Python2 or Python3. KS.
#
# Python versions:
# This code should run under either python 2 or python 3, so long as
# the python 2 version supports the "from __future__ import" used here.
# It has been tested under 2.7 and 3.6.
#
from __future__ import (print_function,division,absolute_import)
import os
import sys
import string
import AdassChecks
def NextVersion (FileName) :
NextVersion = FileName + '_1'
Number = 1
while (os.path.exists(NextVersion)) :
Number = Number + 1
NextVersion = FileName + '_' + str(Number)
return NextVersion
# Defaults
UseAscii = False
UseMacRoman = False
UseLatin1 = False
UseUtf8 = False
CheckEncoding = True
ArgsValid = True
# First, just check we have the necessary filename, and see if an encoding
# was specified.
NumberArgs = len(sys.argv)
if (NumberArgs < 2) :
print("Usage: FixUnprintable filename <encoding>")
print("eg: FixUnprintable P10-3.tex")
ArgsValid = False
if (NumberArgs > 2) :
CheckEncoding = False
Encoding = sys.argv[2]
if (Encoding.lower() == "ascii") : UseAscii = True
elif (Encoding.lower() == "macroman") : UseMacRoman = True
elif (Encoding.lower() == "latin1") : UseLatin1 = True
elif (Encoding.lower() == "utf-8") : UseUtf8 = True
else :
print("Encoding must be one of: ASCII, MacRoman, Latin1, UTF-8")
ArgsValid = False
if (ArgsValid) : print("Will assume file is encoded using",Encoding)
if (ArgsValid) :
TexFileName = sys.argv[1]
if (not os.path.exists(TexFileName)) :
print("Cannot find file '" + TexFileName + "'")
else :
# Unless we've been asked to use a specific encoding, try to determine
# the encoding automatically. GetFileEncoding() will do this.
EncodingOK = True
if (CheckEncoding) :
Report = []
Encodings = []
Certainty = AdassChecks.GetFileEncoding(TexFileName,Encodings,Report)
if (len(Encodings) == 1) :
print("")
if (Encodings[0] == "ASCII") :
print("File is encoded in standard ASCII")
else :
if (Certainty == 100) :
print("File is encoded using",Encodings[0])
else :
print("File appears to be encoded using",Encodings[0])
for Line in Report :
print(Line)
print("")
print("If necessary, restore the saved version an re-run")
print("specifying a different encoding explicitly, eg:")
if (Encodings[0] == "Latin1") :
print("FixUnprintable",TexFileName,"MacRoman")
else :
print("FixUnprintable",TexFileName,"Latin1")
Encoding = Encodings[0].lower()
else :
EncodingOK = False
Message = "File could be encoded using any of: "
for Encoding in Encodings :
Message = Message + ' ' + Encoding
print(Message)
for Line in Report :
print(Line)
print("")
print("Re-run, specifying a different encoding explicitly.")
print("For example, use one of:")
for Encoding in Encodings :
print("FixUnprintable",TexFileName,Encoding)
if (EncodingOK) :
# An initial pass to see if we need to do anything. CheckCharacter()
# doesn't output any messages - it returns any it generates in Details,
# which we ignore - and returns True or False depending on whether
# it found any problem characters.
LineNumber = 0
FileOK = True
InputFile = open(TexFileName,"r")
for Line in InputFile :
LineNumber = LineNumber + 1
Details = []
if (AdassChecks.CheckCharacters(Line,LineNumber,Details,Encoding)) :
FileOK = False
break
# If nothing needed doing, just close the file.
if (FileOK) :
print("Nothing needs doing,",TexFileName,"left unchanged")
InputFile.close()
else :
# A second pass, if necessary, to actually do the fixing.
# FixCharacters() returns a fixed line, and prints out details of
# what it did. If no changes were made, it returns None.
InputFile.seek(0)
WorkFileName = NextVersion("Work.tex")
OutputFile = open(WorkFileName,"w")
LineNumber = 0
for Line in InputFile :
LineNumber = LineNumber + 1
FixedLine = AdassChecks.FixCharacters(Line,LineNumber,Encoding)
if (FixedLine != None) : Line = FixedLine
OutputFile.write(Line)
OutputFile.close()
InputFile.close()
# We now need to rename the files, so the original file becomes a
# saved version, and the work file we just created replaces the
# original file.
SavedFileName = NextVersion(TexFileName)
os.rename(TexFileName,SavedFileName)
os.rename(WorkFileName,TexFileName)
print("Original file saved as",SavedFileName)
This diff is collapsed.
This diff is collapsed.
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Created on Mon 12 Oct 2020 09:44:13 PM EDT by teuben
origin https://github.com/astroumd/ADASSProceedings (fetch)
origin https://github.com/astroumd/ADASSProceedings (push)
2018
* 2020
master
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment