Add pandoc files and figure creation scripts using imagemagick
This commit is contained in:
parent
c9aafb109a
commit
c0a298a5e8
BIN
custom-reference.docx
Normal file
BIN
custom-reference.docx
Normal file
Binary file not shown.
BIN
figure_templates/colorbar.png
Normal file
BIN
figure_templates/colorbar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
400
ieee.csl
Normal file
400
ieee.csl
Normal file
@ -0,0 +1,400 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only">
|
||||
<info>
|
||||
<title>IEEE</title>
|
||||
<id>http://www.zotero.org/styles/ieee</id>
|
||||
<link href="http://www.zotero.org/styles/ieee" rel="self"/>
|
||||
<link href="https://ieeeauthorcenter.ieee.org/wp-content/uploads/IEEE-Reference-Guide.pdf" rel="documentation"/>
|
||||
<link href="https://journals.ieeeauthorcenter.ieee.org/your-role-in-article-production/ieee-editorial-style-manual/" rel="documentation"/>
|
||||
<author>
|
||||
<name>Michael Berkowitz</name>
|
||||
<email>mberkowi@gmu.edu</email>
|
||||
</author>
|
||||
<contributor>
|
||||
<name>Julian Onions</name>
|
||||
<email>julian.onions@gmail.com</email>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Rintze Zelle</name>
|
||||
<uri>http://twitter.com/rintzezelle</uri>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Stephen Frank</name>
|
||||
<uri>http://www.zotero.org/sfrank</uri>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Sebastian Karcher</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Giuseppe Silano</name>
|
||||
<email>g.silano89@gmail.com</email>
|
||||
<uri>http://giuseppesilano.net</uri>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Patrick O'Brien</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Brenton M. Wiernik</name>
|
||||
</contributor>
|
||||
<category citation-format="numeric"/>
|
||||
<category field="engineering"/>
|
||||
<category field="generic-base"/>
|
||||
<summary>IEEE style as per the 2018 guidelines, V 11.12.2018.</summary>
|
||||
<updated>2019-12-20T09:14:19+00:00</updated>
|
||||
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
|
||||
</info>
|
||||
<locale xml:lang="en">
|
||||
<terms>
|
||||
<term name="chapter" form="short">ch.</term>
|
||||
<term name="presented at">presented at the</term>
|
||||
<term name="available at">available</term>
|
||||
</terms>
|
||||
</locale>
|
||||
<!-- Macros -->
|
||||
<macro name="status">
|
||||
<choose>
|
||||
<if variable="page issue volume" match="none">
|
||||
<text variable="status" text-case="capitalize-first" suffix="" font-weight="bold"/>
|
||||
</if>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="edition">
|
||||
<choose>
|
||||
<if type="bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="any">
|
||||
<choose>
|
||||
<if is-numeric="edition">
|
||||
<group delimiter=" ">
|
||||
<number variable="edition" form="ordinal"/>
|
||||
<text term="edition" form="short"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="edition" text-case="capitalize-first" suffix="."/>
|
||||
</else>
|
||||
</choose>
|
||||
</if>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="issued">
|
||||
<choose>
|
||||
<if type="article-journal report" match="any">
|
||||
<date variable="issued">
|
||||
<date-part name="month" form="short" suffix=" "/>
|
||||
<date-part name="year" form="long"/>
|
||||
</date>
|
||||
</if>
|
||||
<else-if type="bill book chapter graphic legal_case legislation motion_picture song thesis" match="any">
|
||||
<date variable="issued">
|
||||
<date-part name="year" form="long"/>
|
||||
</date>
|
||||
</else-if>
|
||||
<else-if type="paper-conference" match="any">
|
||||
<date variable="issued">
|
||||
<date-part name="month" form="short"/>
|
||||
<date-part name="year" prefix=" "/>
|
||||
</date>
|
||||
</else-if>
|
||||
<else>
|
||||
<date variable="issued">
|
||||
<date-part name="month" form="short" suffix=" "/>
|
||||
<date-part name="day" form="numeric-leading-zeros" suffix=", "/>
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="author">
|
||||
<names variable="author">
|
||||
<name and="text" et-al-min="7" et-al-use-first="1" initialize-with=". "/>
|
||||
<label form="short" prefix=", " text-case="capitalize-first"/>
|
||||
<et-al font-style="italic"/>
|
||||
<substitute>
|
||||
<names variable="editor"/>
|
||||
<names variable="translator"/>
|
||||
</substitute>
|
||||
</names>
|
||||
</macro>
|
||||
<macro name="editor">
|
||||
<names variable="editor">
|
||||
<name initialize-with=". " delimiter=", " and="text"/>
|
||||
<label form="short" prefix=", " text-case="capitalize-first"/>
|
||||
</names>
|
||||
</macro>
|
||||
<macro name="locators">
|
||||
<group delimiter=", ">
|
||||
<text macro="edition"/>
|
||||
<group delimiter=" ">
|
||||
<text term="volume" form="short"/>
|
||||
<number variable="volume" form="numeric"/>
|
||||
</group>
|
||||
<group delimiter=" ">
|
||||
<number variable="number-of-volumes" form="numeric"/>
|
||||
<text term="volume" form="short" plural="true"/>
|
||||
</group>
|
||||
<group delimiter=" ">
|
||||
<text term="issue" form="short"/>
|
||||
<number variable="issue" form="numeric"/>
|
||||
</group>
|
||||
</group>
|
||||
</macro>
|
||||
<macro name="title">
|
||||
<choose>
|
||||
<if type="bill book graphic legal_case legislation motion_picture song" match="any">
|
||||
<text variable="title" font-style="italic"/>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="title" quotes="true"/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="publisher">
|
||||
<choose>
|
||||
<if type="bill book chapter graphic legal_case legislation motion_picture paper-conference song" match="any">
|
||||
<group delimiter=": ">
|
||||
<text variable="publisher-place"/>
|
||||
<text variable="publisher"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<group delimiter=", ">
|
||||
<text variable="publisher"/>
|
||||
<text variable="publisher-place"/>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="event">
|
||||
<choose>
|
||||
<if type="paper-conference speech" match="any">
|
||||
<choose>
|
||||
<!-- Published Conference Paper -->
|
||||
<if variable="collection-editor editor editorial-director issue page volume" match="any">
|
||||
<group delimiter=", ">
|
||||
<group delimiter=" ">
|
||||
<text term="in"/>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
</group>
|
||||
<text variable="event-place"/>
|
||||
</group>
|
||||
</if>
|
||||
<!-- Unpublished Conference Paper -->
|
||||
<else>
|
||||
<group delimiter=", ">
|
||||
<group delimiter=" ">
|
||||
<text term="presented at"/>
|
||||
<text variable="event"/>
|
||||
</group>
|
||||
<text variable="event-place"/>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</if>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="access">
|
||||
<choose>
|
||||
<if type="webpage post post-weblog" match="any">
|
||||
<choose>
|
||||
<if variable="URL">
|
||||
<group delimiter=" ">
|
||||
<text variable="URL"/>
|
||||
<group delimiter=" " prefix="(" suffix=")">
|
||||
<text term="accessed"/>
|
||||
<date variable="accessed">
|
||||
<date-part name="month" form="short" strip-periods="false"/>
|
||||
<date-part name="day" form="numeric-leading-zeros" prefix=" " suffix=", "/>
|
||||
<date-part name="year" form="long"/>
|
||||
</date>
|
||||
</group>
|
||||
</group>
|
||||
</if>
|
||||
</choose>
|
||||
</if>
|
||||
<else-if match="any" variable="DOI">
|
||||
<text variable="DOI" prefix="doi: "/>
|
||||
</else-if>
|
||||
<else>
|
||||
<group delimiter=". ">
|
||||
<group delimiter=": ">
|
||||
<text term="accessed" text-case="capitalize-first"/>
|
||||
<date variable="accessed">
|
||||
<date-part name="month" form="short" suffix=" "/>
|
||||
<date-part name="day" form="numeric-leading-zeros" suffix=", "/>
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</group>
|
||||
<text term="online" prefix="[" suffix="]" text-case="capitalize-first"/>
|
||||
<group delimiter=": ">
|
||||
<text term="available at" text-case="capitalize-first"/>
|
||||
<text variable="URL"/>
|
||||
</group>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="page">
|
||||
<choose>
|
||||
<if type="article-journal" variable="number" match="all">
|
||||
<group delimiter=" ">
|
||||
<text value="Art."/>
|
||||
<text term="issue" form="short"/>
|
||||
<text variable="number"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<group delimiter=" ">
|
||||
<label variable="page" form="short"/>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="citation-locator">
|
||||
<group delimiter=" ">
|
||||
<choose>
|
||||
<if locator="page">
|
||||
<label variable="locator" form="short"/>
|
||||
</if>
|
||||
<else>
|
||||
<label variable="locator" form="short" text-case="capitalize-first"/>
|
||||
</else>
|
||||
</choose>
|
||||
<text variable="locator"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- Citation -->
|
||||
<citation collapse="citation-number">
|
||||
<sort>
|
||||
<key variable="citation-number"/>
|
||||
</sort>
|
||||
<layout delimiter=", ">
|
||||
<group prefix="[" suffix="]" delimiter=", ">
|
||||
<text variable="citation-number"/>
|
||||
<text macro="citation-locator"/>
|
||||
</group>
|
||||
</layout>
|
||||
</citation>
|
||||
<!-- Bibliography -->
|
||||
<bibliography entry-spacing="0" second-field-align="flush">
|
||||
<layout suffix=".">
|
||||
<!-- Citation Number -->
|
||||
<text variable="citation-number" prefix="[" suffix="]"/>
|
||||
<!-- Author(s) -->
|
||||
<text macro="author" suffix=", "/>
|
||||
<!-- Rest of Citation -->
|
||||
<choose>
|
||||
<!-- Specific Formats -->
|
||||
<if type="article-journal">
|
||||
<group delimiter=", ">
|
||||
<text macro="title"/>
|
||||
<text variable="container-title" font-style="italic" form="short"/>
|
||||
<text macro="locators"/>
|
||||
<text macro="page"/>
|
||||
<text macro="issued"/>
|
||||
<text macro="status"/>
|
||||
<text macro="access"/>
|
||||
</group>
|
||||
</if>
|
||||
<else-if type="paper-conference speech" match="any">
|
||||
<group delimiter=", ">
|
||||
<text macro="title"/>
|
||||
<text macro="event"/>
|
||||
<text macro="issued"/>
|
||||
<text macro="locators"/>
|
||||
<text macro="page"/>
|
||||
<text macro="status"/>
|
||||
<text macro="access"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="report">
|
||||
<group delimiter=". ">
|
||||
<group delimiter=", ">
|
||||
<text macro="title"/>
|
||||
<text macro="publisher"/>
|
||||
<group delimiter=" ">
|
||||
<text variable="genre"/>
|
||||
<text variable="number"/>
|
||||
</group>
|
||||
<text macro="issued"/>
|
||||
</group>
|
||||
<text macro="access"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="thesis">
|
||||
<group delimiter=", ">
|
||||
<text macro="title"/>
|
||||
<text variable="genre"/>
|
||||
<text macro="publisher"/>
|
||||
<text macro="issued"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="webpage post-weblog post" match="any">
|
||||
<group delimiter=", " suffix=". ">
|
||||
<text macro="title"/>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
<text macro="issued"/>
|
||||
</group>
|
||||
<text macro="access"/>
|
||||
</else-if>
|
||||
<else-if type="patent">
|
||||
<group delimiter=", ">
|
||||
<text macro="title"/>
|
||||
<text variable="number"/>
|
||||
<text macro="issued"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<!-- Generic/Fallback Formats -->
|
||||
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
|
||||
<group delimiter=", " suffix=". ">
|
||||
<text macro="title"/>
|
||||
<text macro="locators"/>
|
||||
</group>
|
||||
<group delimiter=", ">
|
||||
<text macro="publisher"/>
|
||||
<text macro="issued"/>
|
||||
<text macro="page"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="article-magazine article-newspaper broadcast interview manuscript map patent personal_communication song speech thesis webpage" match="any">
|
||||
<group delimiter=", ">
|
||||
<text macro="title"/>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
<text macro="locators"/>
|
||||
<text macro="publisher"/>
|
||||
<text macro="page"/>
|
||||
<text macro="issued"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="chapter paper-conference" match="any">
|
||||
<group delimiter=", " suffix=", ">
|
||||
<text macro="title"/>
|
||||
<group delimiter=" ">
|
||||
<text term="in"/>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
</group>
|
||||
<text macro="locators"/>
|
||||
</group>
|
||||
<text macro="editor" suffix=" "/>
|
||||
<group delimiter=", ">
|
||||
<text macro="publisher"/>
|
||||
<text macro="issued"/>
|
||||
<text macro="page"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else>
|
||||
<group delimiter=", " suffix=". ">
|
||||
<text macro="title"/>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
<text macro="locators"/>
|
||||
</group>
|
||||
<group delimiter=", ">
|
||||
<text macro="publisher"/>
|
||||
<text macro="page"/>
|
||||
<text macro="issued"/>
|
||||
<text macro="access"/>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</layout>
|
||||
</bibliography>
|
||||
</style>
|
33
mkdoc
Executable file
33
mkdoc
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
#This is a script to make document directories and copies template files over
|
||||
|
||||
function fail {
|
||||
printf '%s\n' "$1" >&2
|
||||
exit "${2-1}"
|
||||
}
|
||||
|
||||
#Make the new project directory
|
||||
if [ ! -d $1 ]; then
|
||||
mkdir $1 || fail "Failed making project directory exiting script"
|
||||
fi
|
||||
|
||||
#Set up the file structures
|
||||
cd $1
|
||||
|
||||
if [ ! -d Figures ]; then
|
||||
mkdir Figures
|
||||
fi
|
||||
|
||||
|
||||
case $2 in
|
||||
"article")
|
||||
cp ~/typsetting/article.tex ~/typesetting/GTLogo.pdf . ;;
|
||||
"presentation")
|
||||
cp ~/typsetting/presentation.tex ~/typesetting/GTLogo.pdf . ;;
|
||||
"notes")
|
||||
cp ~/typesetting/notes.md . ;;
|
||||
*)
|
||||
fail "$2 does not have a template"
|
||||
esac
|
||||
|
30
notes.md
Normal file
30
notes.md
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
title: "<++>"
|
||||
|
||||
|
||||
###
|
||||
### Bibliography settings
|
||||
###
|
||||
bibliography:
|
||||
- /home/aselimov/typesetting/references.bib
|
||||
csl: /home/aselimov/typesetting/ieee.csl
|
||||
link-citations: true
|
||||
|
||||
|
||||
###
|
||||
### Formatting settings
|
||||
###
|
||||
documentclass: article
|
||||
fontsize: 12pt
|
||||
#geometry: margin=1.0in
|
||||
geometry: "left=3cm,right=3cm,top=2cm,bottom=2cm"
|
||||
header-includes:
|
||||
- \usepackage{times}
|
||||
- \usepackage{amsmath}
|
||||
urlcolor: blue
|
||||
output:
|
||||
rmarkdown::pdf_document:
|
||||
---
|
||||
|
||||
<++>
|
||||
|
109
pagebreak.lua
Normal file
109
pagebreak.lua
Normal file
@ -0,0 +1,109 @@
|
||||
--[[
|
||||
pagebreak – convert raw LaTeX page breaks to other formats
|
||||
|
||||
Copyright © 2017-2020 Benct Philip Jonsson, Albert Krewinkel
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
]]
|
||||
local stringify_orig = (require 'pandoc.utils').stringify
|
||||
|
||||
local function stringify(x)
|
||||
return type(x) == 'string' and x or stringify_orig(x)
|
||||
end
|
||||
|
||||
--- configs – these are populated in the Meta filter.
|
||||
local pagebreak = {
|
||||
asciidoc = '<<<\n\n',
|
||||
context = '\\page',
|
||||
epub = '<p style="page-break-after: always;"> </p>',
|
||||
html = '<div style="page-break-after: always;"></div>',
|
||||
latex = '\\newpage{}',
|
||||
ms = '.bp',
|
||||
ooxml = '<w:p><w:r><w:br w:type="page"/></w:r></w:p>',
|
||||
odt = '<text:p text:style-name="Pagebreak"/>'
|
||||
}
|
||||
|
||||
local function pagebreaks_from_config (meta)
|
||||
local html_class =
|
||||
(meta.newpage_html_class and stringify(meta.newpage_html_class))
|
||||
or os.getenv 'PANDOC_NEWPAGE_HTML_CLASS'
|
||||
if html_class and html_class ~= '' then
|
||||
pagebreak.html = string.format('<div class="%s"></div>', html_class)
|
||||
end
|
||||
|
||||
local odt_style =
|
||||
(meta.newpage_odt_style and stringify(meta.newpage_odt_style))
|
||||
or os.getenv 'PANDOC_NEWPAGE_ODT_STYLE'
|
||||
if odt_style and odt_style ~= '' then
|
||||
pagebreak.odt = string.format('<text:p text:style-name="%s"/>', odt_style)
|
||||
end
|
||||
end
|
||||
|
||||
--- Return a block element causing a page break in the given format.
|
||||
local function newpage(format)
|
||||
if format:match 'asciidoc' then
|
||||
return pandoc.RawBlock('asciidoc', pagebreak.asciidoc)
|
||||
elseif format == 'context' then
|
||||
return pandoc.RawBlock('context', pagebreak.context)
|
||||
elseif format == 'docx' then
|
||||
return pandoc.RawBlock('openxml', pagebreak.ooxml)
|
||||
elseif format:match 'epub' then
|
||||
return pandoc.RawBlock('html', pagebreak.epub)
|
||||
elseif format:match 'html.*' then
|
||||
return pandoc.RawBlock('html', pagebreak.html)
|
||||
elseif format:match 'latex' then
|
||||
return pandoc.RawBlock('tex', pagebreak.latex)
|
||||
elseif format:match 'ms' then
|
||||
return pandoc.RawBlock('ms', pagebreak.ms)
|
||||
elseif format:match 'odt' then
|
||||
return pandoc.RawBlock('opendocument', pagebreak.odt)
|
||||
else
|
||||
-- fall back to insert a form feed character
|
||||
return pandoc.Para{pandoc.Str '\f'}
|
||||
end
|
||||
end
|
||||
|
||||
local function is_newpage_command(command)
|
||||
return command:match '^\\newpage%{?%}?$'
|
||||
or command:match '^\\pagebreak%{?%}?$'
|
||||
end
|
||||
|
||||
-- Filter function called on each RawBlock element.
|
||||
function RawBlock (el)
|
||||
-- Don't do anything if the output is TeX
|
||||
if FORMAT:match 'tex$' then
|
||||
return nil
|
||||
end
|
||||
-- check that the block is TeX or LaTeX and contains only
|
||||
-- \newpage or \pagebreak.
|
||||
if el.format:match 'tex' and is_newpage_command(el.text) then
|
||||
-- use format-specific pagebreak marker. FORMAT is set by pandoc to
|
||||
-- the targeted output format.
|
||||
return newpage(FORMAT)
|
||||
end
|
||||
-- otherwise, leave the block unchanged
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Turning paragraphs which contain nothing but a form feed
|
||||
-- characters into line breaks.
|
||||
function Para (el)
|
||||
if #el.content == 1 and el.content[1].text == '\f' then
|
||||
return newpage(FORMAT)
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{Meta = pagebreaks_from_config},
|
||||
{RawBlock = RawBlock, Para = Para}
|
||||
}
|
3670
references.bib
Normal file
3670
references.bib
Normal file
File diff suppressed because it is too large
Load Diff
96
scripts/captionify
Executable file
96
scripts/captionify
Executable file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
##This script adds a caption to a figure using imagemagick
|
||||
####
|
||||
#Help
|
||||
####
|
||||
Help(){
|
||||
echo "Add a caption to an image using imagemagic"
|
||||
echo
|
||||
echo "Syntax: captionify [-h|-d|-o <out_file>|-s <size>|-p <pad>] infile message"
|
||||
echo "options:"
|
||||
echo "-h: Print this help message"
|
||||
echo '-d: Open image defined in $VIEWER'
|
||||
echo "-o: Specify output file, otherwise the output gets written to caption_infile"
|
||||
echo "-s: Specify font size"
|
||||
echo "infile: The file to be processed"
|
||||
echo "message: The message to be added"
|
||||
}
|
||||
|
||||
##Image Viewer
|
||||
|
||||
args=()
|
||||
argnum=0
|
||||
outfile=""
|
||||
display=0
|
||||
pad=20
|
||||
|
||||
if [ "$VIEWER" = '' ]; then
|
||||
openin=sxiv
|
||||
else
|
||||
openin=$VIEWER
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
unset OPTIND
|
||||
unset OPTARG
|
||||
#Parse Flags
|
||||
while getopts 'hdo:s:p:' options; do
|
||||
case $options in
|
||||
h)
|
||||
Help
|
||||
break;;
|
||||
d)
|
||||
display=1;;
|
||||
o)
|
||||
outfile="$OPTARG";;
|
||||
s)
|
||||
size="$OPTARG";;
|
||||
p)
|
||||
pad="$OPTARG";;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
args+=("$1")
|
||||
(( argnum++ ))
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$args" = "" ]; then
|
||||
Help
|
||||
elif [ $argnum -gt 2 ]; then
|
||||
echo "Captionify takes only two positional parameter, please view help"
|
||||
elif [ $argnum -lt 2 ]; then
|
||||
echo "Captionify requires two positional parameters, please view help"
|
||||
else
|
||||
infile="${args[0]}"
|
||||
message="${args[1]}"
|
||||
#Set defaults if variable unset
|
||||
if [ "$outfile" = "" ]; then
|
||||
outfile="cap_$infile"
|
||||
fi
|
||||
|
||||
if [ "$size" = "" ]; then
|
||||
size=48
|
||||
fi
|
||||
|
||||
#Now add some small padding
|
||||
if [ $pad -gt 0 ]; then
|
||||
width=$(identify -format '%w' $infile)
|
||||
height=$(identify -format '%h' $infile)
|
||||
(( height = height + pad ))
|
||||
convert -extent "${width}x${height}" $infile $outfile
|
||||
infile=$outfile
|
||||
fi
|
||||
#Now run the actual imagemagick command
|
||||
montage -background '#ffffffa0' -label "$message" $infile \
|
||||
-fill black -font Helvetica -pointsize $size \
|
||||
-geometry +0+0 $outfile
|
||||
|
||||
|
||||
if [ $display -eq 1 ]; then
|
||||
$openin $outfile
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
91
scripts/colorbar
Executable file
91
scripts/colorbar
Executable file
@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
##This creates a red to blue divergent colorbar with specified label and bounds.
|
||||
####
|
||||
#Help
|
||||
####
|
||||
Help(){
|
||||
echo "This creates a colorbar image file with specified boundaries and tag"
|
||||
echo
|
||||
echo "Syntax: colorbar [-h|-o outfile|-x width|-y height] caption lobd hibd"
|
||||
echo "options:"
|
||||
echo "-h: print this help"
|
||||
echo "-o: Specify file to write to"
|
||||
echo "-x: Specify width of colorbar image. Cannot be used with -y"
|
||||
echo "-y: Specify height of colorbar image. Cannot be used with -x"
|
||||
echo "caption: Caption for the colorbar"
|
||||
echo "lobd: Lower bound of the color bar"
|
||||
echo "hibd: Upper bound of the color bar"
|
||||
}
|
||||
|
||||
|
||||
outfile='colorbar.png'
|
||||
args=()
|
||||
argnum=0
|
||||
x=0
|
||||
y=0
|
||||
while [ $# -gt 0 ]; do
|
||||
unset OPTIND
|
||||
unset OPTARG
|
||||
#Parse Flags
|
||||
while getopts ':hox:y:' options; do
|
||||
case $options in
|
||||
h)
|
||||
Help
|
||||
break;;
|
||||
o)
|
||||
outfile="$OPTARG";;
|
||||
x)
|
||||
x="$OPTARG"
|
||||
if [ $y -ne 0 ]; then
|
||||
echo "Cannot use both -x and -y options"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
y)
|
||||
y="$OPTARG"
|
||||
if [ $x -ne 0 ]; then
|
||||
echo "Cannot use both -x and -y options"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
args+=("$1")
|
||||
(( argnum++ ))
|
||||
shift
|
||||
done
|
||||
|
||||
#Now pull out the required arguments
|
||||
if [ "$args" = "" ]; then
|
||||
Help
|
||||
elif [ $argnum -ne 3 ]; then
|
||||
echo "colorbar requires three positional arguments, please view help"
|
||||
else
|
||||
msg="${args[0]}"
|
||||
lobd="${args[1]}"
|
||||
hibd="${args[2]}"
|
||||
|
||||
#First copy colorbar file to current directory
|
||||
cp ~/typesetting/figure_templates/colorbar.png $outfile
|
||||
|
||||
#Now create lower and upper labels
|
||||
convert -background " #FFF " -fill black -font Helvetica -size x196 label:"$lobd" tmp1.png
|
||||
convert -background " #FFF " -fill black -font Helvetica -size x196 label:"$hibd" tmp2.png
|
||||
convert +append -gravity center tmp1.png $outfile tmp2.png $outfile
|
||||
|
||||
#Now create caption for image
|
||||
convert -background " #FFF " -fill black -font Helvetica -size x196 label:"$msg" tmp.png
|
||||
convert -append -gravity center tmp.png $outfile $outfile
|
||||
|
||||
#Final step is resizing
|
||||
if [ $x -gt 0 ]; then
|
||||
convert -scale "$x"x $outfile $outfile
|
||||
fi
|
||||
if [ $y -gt 0 ]; then
|
||||
convert -scale x"$y" $outfile $outfile
|
||||
fi
|
||||
rm tmp.png tmp1.png tmp2.png
|
||||
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user