Initial open source commit

This commit is contained in:
James Allen
2014-02-12 17:27:43 +00:00
commit c83b03e93f
95 changed files with 16218 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
Client = require "./helpers/Client"
request = require "request"
require("chai").should()
describe "Broken LaTeX file", ->
before ->
@broken_request =
resources: [
path: "main.tex"
content: '''
\\documentclass{articl % :(
\\begin{documen % :(
Broken
\\end{documen % :(
'''
]
@correct_request =
resources: [
path: "main.tex"
content: '''
\\documentclass{article}
\\begin{document}
Hello world
\\end{document}
'''
]
describe "on first run", ->
before (done) ->
@project_id = Client.randomId()
Client.compile @project_id, @broken_request, (@error, @res, @body) => done()
it "should return a failure status", ->
@body.compile.status.should.equal "failure"
describe "on second run", ->
before (done) ->
@project_id = Client.randomId()
Client.compile @project_id, @correct_request, () =>
Client.compile @project_id, @broken_request, (@error, @res, @body) =>
done()
it "should return a failure status", ->
@body.compile.status.should.equal "failure"

View File

@@ -0,0 +1,34 @@
Client = require "./helpers/Client"
request = require "request"
require("chai").should()
describe "Deleting Old Files", ->
before ->
@request =
resources: [
path: "main.tex"
content: '''
\\documentclass{article}
\\begin{document}
Hello world
\\end{document}
'''
]
describe "on first run", ->
before (done) ->
@project_id = Client.randomId()
Client.compile @project_id, @request, (@error, @res, @body) => done()
it "should return a success status", ->
@body.compile.status.should.equal "success"
describe "after file has been deleted", ->
before (done) ->
@request.resources = []
Client.compile @project_id, @request, (@error, @res, @body) =>
done()
it "should return a failure status", ->
@body.compile.status.should.equal "failure"

View File

@@ -0,0 +1,79 @@
Client = require "./helpers/Client"
request = require "request"
require("chai").should()
fs = require "fs"
ChildProcess = require "child_process"
fixturePath = (path) -> __dirname + "/../fixtures/" + path
convertToPng = (pdfPath, pngPath, callback = (error) ->) ->
convert = ChildProcess.exec "convert #{fixturePath(pdfPath)} #{fixturePath(pngPath)}"
convert.on "exit", () ->
callback()
compare = (originalPath, generatedPath, callback = (error, same) ->) ->
proc = ChildProcess.exec "compare -metric mae #{fixturePath(originalPath)} #{fixturePath(generatedPath)} #{fixturePath("tmp/diff.png")}"
stderr = ""
proc.stderr.on "data", (chunk) -> stderr += chunk
proc.on "exit", () ->
if stderr.trim() == "0 (0)"
callback null, true
else
console.log stderr
callback null, false
compareMultiplePages = (project_id, callback = (error) ->) ->
compareNext = (page_no, callback) ->
path = "tmp/#{project_id}-source-#{page_no}.png"
fs.stat fixturePath(path), (error, stat) ->
if error?
callback()
else
compare "tmp/#{project_id}-source-#{page_no}.png", "tmp/#{project_id}-generated-#{page_no}.png", (error, same) =>
throw error if error?
same.should.equal true
compareNext page_no + 1, callback
compareNext 0, callback
downloadAndComparePdf = (project_id, example_dir, url, callback = (error) ->) ->
writeStream = fs.createWriteStream(fixturePath("tmp/#{project_id}.pdf"))
request.get(url).pipe(writeStream)
writeStream.on "close", () =>
convertToPng "tmp/#{project_id}.pdf", "tmp/#{project_id}-generated.png", (error) =>
throw error if error?
convertToPng "examples/#{example_dir}/output.pdf", "tmp/#{project_id}-source.png", (error) =>
throw error if error?
fs.stat fixturePath("tmp/#{project_id}-source-0.png"), (error, stat) =>
if error?
compare "tmp/#{project_id}-source.png", "tmp/#{project_id}-generated.png", (error, same) =>
throw error if error?
same.should.equal true
callback()
else
compareMultiplePages project_id, (error) ->
throw error if error?
callback()
Client.runServer(4242, fixturePath("examples"))
describe "Example Documents", ->
before (done) ->
ChildProcess.exec("rm test/acceptance/fixtures/tmp/*").on "exit", () -> done()
for example_dir in fs.readdirSync fixturePath("examples")
do (example_dir) ->
describe example_dir, ->
before ->
@project_id = Client.randomId()
it "should generate the correct pdf", (done) ->
Client.compileDirectory @project_id, fixturePath("examples"), example_dir, 4242, (error, res, body) =>
pdf = Client.getOutputFile body, "pdf"
downloadAndComparePdf(@project_id, example_dir, pdf.url, done)
it "should generate the correct pdf on the second run as well", (done) ->
Client.compileDirectory @project_id, fixturePath("examples"), example_dir, 4242, (error, res, body) =>
pdf = Client.getOutputFile body, "pdf"
downloadAndComparePdf(@project_id, example_dir, pdf.url, done)

View File

@@ -0,0 +1,39 @@
Client = require "./helpers/Client"
request = require "request"
require("chai").should()
describe "Simple LaTeX file", ->
before (done) ->
@project_id = Client.randomId()
@request =
resources: [
path: "main.tex"
content: '''
\\documentclass{article}
\\begin{document}
Hello world
\\end{document}
'''
]
Client.compile @project_id, @request, (@error, @res, @body) => done()
it "should return the PDF", ->
pdf = Client.getOutputFile(@body, "pdf")
pdf.type.should.equal "pdf"
it "should return the log", ->
log = Client.getOutputFile(@body, "log")
log.type.should.equal "log"
it "should provide the pdf for download", (done) ->
pdf = Client.getOutputFile(@body, "pdf")
request.get pdf.url, (error, res, body) ->
res.statusCode.should.equal 200
done()
it "should provide the log for download", (done) ->
log = Client.getOutputFile(@body, "pdf")
request.get log.url, (error, res, body) ->
res.statusCode.should.equal 200
done()

View File

@@ -0,0 +1,27 @@
Client = require "./helpers/Client"
request = require "request"
require("chai").should()
describe "Timed out compile", ->
before (done) ->
@request =
options:
timeout: 0.01 #seconds
resources: [
path: "main.tex"
content: '''
\\documentclass{article}
\\begin{document}
Hello world
\\end{document}
'''
]
@project_id = Client.randomId()
Client.compile @project_id, @request, (@error, @res, @body) => done()
it "should return a timeout error", ->
@body.compile.error.should.equal "container timed out"
it "should return a failure status", ->
@body.compile.status.should.equal "failure"

View File

@@ -0,0 +1,220 @@
Client = require "./helpers/Client"
request = require "request"
require("chai").should()
sinon = require "sinon"
host = "localhost"
Server =
run: () ->
express = require "express"
app = express()
staticServer = express.static __dirname + "/../fixtures/"
app.get "/:random_id/*", (req, res, next) =>
@getFile(req.url)
req.url = "/" + req.params[0]
staticServer(req, res, next)
app.listen 31415, host
getFile: () ->
randomId: () ->
Math.random().toString(16).slice(2)
Server.run()
describe "Url Caching", ->
describe "Downloading an image for the first time", ->
before (done) ->
@project_id = Client.randomId()
@file = "#{Server.randomId()}/lion.png"
@request =
resources: [{
path: "main.tex"
content: '''
\\documentclass{article}
\\usepackage{graphicx}
\\begin{document}
\\includegraphics{lion.png}
\\end{document}
'''
}, {
path: "lion.png"
url: "http://#{host}:31415/#{@file}"
}]
sinon.spy Server, "getFile"
Client.compile @project_id, @request, (@error, @res, @body) => done()
afterEach ->
Server.getFile.restore()
it "should download the image", ->
Server.getFile
.calledWith("/" + @file)
.should.equal true
describe "When an image is in the cache and the last modified date is unchanged", ->
before (done) ->
@project_id = Client.randomId()
@file = "#{Server.randomId()}/lion.png"
@request =
resources: [{
path: "main.tex"
content: '''
\\documentclass{article}
\\usepackage{graphicx}
\\begin{document}
\\includegraphics{lion.png}
\\end{document}
'''
}, @image_resource = {
path: "lion.png"
url: "http://#{host}:31415/#{@file}"
modified: Date.now()
}]
Client.compile @project_id, @request, (@error, @res, @body) =>
sinon.spy Server, "getFile"
Client.compile @project_id, @request, (@error, @res, @body) =>
done()
after ->
Server.getFile.restore()
it "should not download the image again", ->
Server.getFile.called.should.equal false
describe "When an image is in the cache and the last modified date is advanced", ->
before (done) ->
@project_id = Client.randomId()
@file = "#{Server.randomId()}/lion.png"
@request =
resources: [{
path: "main.tex"
content: '''
\\documentclass{article}
\\usepackage{graphicx}
\\begin{document}
\\includegraphics{lion.png}
\\end{document}
'''
}, @image_resource = {
path: "lion.png"
url: "http://#{host}:31415/#{@file}"
modified: @last_modified = Date.now()
}]
Client.compile @project_id, @request, (@error, @res, @body) =>
sinon.spy Server, "getFile"
@image_resource.modified = new Date(@last_modified + 3000)
Client.compile @project_id, @request, (@error, @res, @body) =>
done()
afterEach ->
Server.getFile.restore()
it "should download the image again", ->
Server.getFile.called.should.equal true
describe "When an image is in the cache and the last modified date is further in the past", ->
before (done) ->
@project_id = Client.randomId()
@file = "#{Server.randomId()}/lion.png"
@request =
resources: [{
path: "main.tex"
content: '''
\\documentclass{article}
\\usepackage{graphicx}
\\begin{document}
\\includegraphics{lion.png}
\\end{document}
'''
}, @image_resource = {
path: "lion.png"
url: "http://#{host}:31415/#{@file}"
modified: @last_modified = Date.now()
}]
Client.compile @project_id, @request, (@error, @res, @body) =>
sinon.spy Server, "getFile"
@image_resource.modified = new Date(@last_modified - 3000)
Client.compile @project_id, @request, (@error, @res, @body) =>
done()
afterEach ->
Server.getFile.restore()
it "should not download the image again", ->
Server.getFile.called.should.equal false
describe "When an image is in the cache and the last modified date is not specified", ->
before (done) ->
@project_id = Client.randomId()
@file = "#{Server.randomId()}/lion.png"
@request =
resources: [{
path: "main.tex"
content: '''
\\documentclass{article}
\\usepackage{graphicx}
\\begin{document}
\\includegraphics{lion.png}
\\end{document}
'''
}, @image_resource = {
path: "lion.png"
url: "http://#{host}:31415/#{@file}"
modified: @last_modified = Date.now()
}]
Client.compile @project_id, @request, (@error, @res, @body) =>
sinon.spy Server, "getFile"
delete @image_resource.modified
Client.compile @project_id, @request, (@error, @res, @body) =>
done()
afterEach ->
Server.getFile.restore()
it "should download the image again", ->
Server.getFile.called.should.equal true
describe "After clearing the cache", ->
before (done) ->
@project_id = Client.randomId()
@file = "#{Server.randomId()}/lion.png"
@request =
resources: [{
path: "main.tex"
content: '''
\\documentclass{article}
\\usepackage{graphicx}
\\begin{document}
\\includegraphics{lion.png}
\\end{document}
'''
}, @image_resource = {
path: "lion.png"
url: "http://#{host}:31415/#{@file}"
modified: @last_modified = Date.now()
}]
Client.compile @project_id, @request, (error) =>
throw error if error?
Client.clearCache @project_id, (error, res, body) =>
throw error if error?
sinon.spy Server, "getFile"
Client.compile @project_id, @request, (@error, @res, @body) =>
done()
afterEach ->
Server.getFile.restore()
it "should download the image again", ->
Server.getFile.called.should.equal true

View File

@@ -0,0 +1,69 @@
request = require "request"
fs = require "fs"
Settings = require "../../../../app/js/Settings"
host = "localhost"
module.exports = Client =
host: Settings.externalUrl
randomId: () ->
Math.random().toString(16).slice(2)
compile: (project_id, data, callback = (error, res, body) ->) ->
request.post {
url: "#{@host}/project/#{project_id}/compile"
json:
compile: data
}, callback
clearCache: (project_id, callback = (error, res, body) ->) ->
request.del "#{@host}/project/#{project_id}", callback
getOutputFile: (response, type) ->
for file in response.compile.outputFiles
if file.type == type
return file
return null
runServer: (port, directory) ->
express = require("express")
app = express()
app.use express.static(directory)
app.listen(port, host)
compileDirectory: (project_id, baseDirectory, directory, serverPort, callback = (error, res, body) ->) ->
resources = []
entities = fs.readdirSync("#{baseDirectory}/#{directory}")
rootResourcePath = "main.tex"
while (entities.length > 0)
entity = entities.pop()
stat = fs.statSync("#{baseDirectory}/#{directory}/#{entity}")
if stat.isDirectory()
entities = entities.concat fs.readdirSync("#{baseDirectory}/#{directory}/#{entity}").map (subEntity) ->
if subEntity == "main.tex"
rootResourcePath = "#{entity}/#{subEntity}"
return "#{entity}/#{subEntity}"
else if stat.isFile() and entity != "output.pdf"
extension = entity.split(".").pop()
if ["tex", "bib", "cls", "sty", "pdf_tex", "Rtex"].indexOf(extension) > -1
resources.push
path: entity
content: fs.readFileSync("#{baseDirectory}/#{directory}/#{entity}").toString()
else if ["eps", "ttf", "png", "jpg", "pdf", "jpeg"].indexOf(extension) > -1
resources.push
path: entity
url: "http://#{host}:#{serverPort}/#{directory}/#{entity}"
modified: stat.mtime
fs.readFile "#{baseDirectory}/#{directory}/options.json", (error, body) =>
req =
resources: resources
rootResourcePath: rootResourcePath
if !error?
body = JSON.parse body
req.options = body
@compile project_id, req, callback

View File

@@ -0,0 +1,9 @@
@book{DouglasAdams,
title={The Hitchhiker's Guide to the Galaxy},
author={Adams, Douglas},
isbn={9781417642595},
url={http://books.google.com/books?id=W-xMPgAACAAJ},
year={1995},
publisher={San Val}
}

View File

@@ -0,0 +1,12 @@
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{bibliography.bib}
\begin{document}
The meaning of life, the universe and everything is 42 \cite{DouglasAdams}
\printbibliography
\end{document}

View File

@@ -0,0 +1,48 @@
% $ biblatex auxiliary file $
% $ biblatex version 1.5 $
% $ biber version 0.9.3 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber or bibtex as required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
{\@latex@error
{Missing 'biblatex' package}
{The bibliography requires the 'biblatex' package.}
\aftergroup\endinput}
{}
\endgroup
\refsection{0}
\entry{DouglasAdams}{book}{}
\name{labelname}{1}{}{%
{{}{Adams}{A\bibinitperiod}{Douglas}{D\bibinitperiod}{}{}{}{}}%
}
\name{author}{1}{}{%
{{}{Adams}{A\bibinitperiod}{Douglas}{D\bibinitperiod}{}{}{}{}}%
}
\list{publisher}{1}{%
{San Val}%
}
\strng{namehash}{AD1}
\strng{fullhash}{AD1}
\field{sortinit}{A}
\field{isbn}{9781417642595}
\field{title}{The Hitchhiker's Guide to the Galaxy}
\field{year}{1995}
\verb{url}
\verb http://books.google.com/books?id=W-xMPgAACAAJ
\endverb
\endentry
\lossort
\endlossort
\endrefsection
\endinput

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
<!ELEMENT requests (internal | external)*>
<!ELEMENT internal (generic, (provides | requires)*)>
<!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
<!ELEMENT cmdline (binary, (option | infile | outfile)*)>
<!ELEMENT input (file)+>
<!ELEMENT output (file)+>
<!ELEMENT provides (file)+>
<!ELEMENT requires (file)+>
<!ELEMENT generic (#PCDATA)>
<!ELEMENT binary (#PCDATA)>
<!ELEMENT option (#PCDATA)>
<!ELEMENT infile (#PCDATA)>
<!ELEMENT outfile (#PCDATA)>
<!ELEMENT file (#PCDATA)>
<!ATTLIST requests
version CDATA #REQUIRED
>
<!ATTLIST internal
package CDATA #REQUIRED
priority (9) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST external
package CDATA #REQUIRED
priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
active (0 | 1) #REQUIRED
>
<!ATTLIST provides
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST requires
type (static | dynamic | editable) #REQUIRED
>
<!ATTLIST file
type CDATA #IMPLIED
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>output.bcf</file>
</provides>
<requires type="dynamic">
<file>output.bbl</file>
</requires>
<requires type="static">
<file>blx-compat.def</file>
<file>biblatex.def</file>
<file>numeric.bbx</file>
<file>standard.bbx</file>
<file>numeric.cbx</file>
<file>biblatex.cfg</file>
<file>english.lbx</file>
</requires>
</internal>
<external package="biblatex" priority="5" active="0">
<generic>biber</generic>
<cmdline>
<binary>biber</binary>
<infile>output</infile>
</cmdline>
<input>
<file>output.bcf</file>
</input>
<output>
<file>output.bbl</file>
</output>
<provides type="dynamic">
<file>output.bbl</file>
</provides>
<requires type="dynamic">
<file>output.bcf</file>
</requires>
<requires type="editable">
<file>bibliography.bib</file>
</requires>
</external>
</requests>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
\documentclass{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\begin{document}
\includegraphics[width=\textwidth]{image}
\end{document}

Binary file not shown.

View File

@@ -0,0 +1,28 @@
\documentclass[a4paper]{article}
\usepackage{feynmf}
\begin{document}
\setlength{\unitlength}{1mm}
\begin{fmffile}{diagram}
\begin{center}
\begin{fmfgraph*}(41,17)
\fmfleftn{i}{2}
\fmfrightn{o}{2}
\fmflabel{$g_2$}{i1}
\fmflabel{$g_1$}{i2}
\fmflabel{$p_2$}{o1}
\fmflabel{$p_1$}{o2}
\fmf{quark}{i1,v1}
\fmf{quark}{i2,v1}
\fmfblob{.35w}{v1}
\fmf{quark}{v1,o1}
\fmf{quark}{v1,o2}
\end{fmfgraph*}
\end{center}
\end{fmffile}
\end{document}

Binary file not shown.

View File

@@ -0,0 +1,28 @@
\documentclass[a4paper]{article}
\usepackage{feynmp}
\begin{document}
\setlength{\unitlength}{1mm}
\begin{fmffile}{diagram}
\begin{center}
\begin{fmfgraph*}(41,17)
\fmfleftn{i}{2}
\fmfrightn{o}{2}
\fmflabel{$g_2$}{i1}
\fmflabel{$g_1$}{i2}
\fmflabel{$p_2$}{o1}
\fmflabel{$p_1$}{o2}
\fmf{quark}{i1,v1}
\fmf{quark}{i2,v1}
\fmfblob{.35w}{v1}
\fmf{quark}{v1,o1}
\fmf{quark}{v1,o2}
\end{fmfgraph*}
\end{center}
\end{fmffile}
\end{document}

View File

@@ -0,0 +1,3 @@
{
"compiler": "latex"
}

Binary file not shown.

View File

@@ -0,0 +1,17 @@
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{Physics}{
name=Physics,
description={is the study of stuff}
}
\begin{document}
To solve various problems in \Gls{Physics} it can useful to express any arbitrary piecewise-smooth function as a Fourier Series composed of multiple sine and cosine funcions.
\printglossaries
\end{document}

View File

@@ -0,0 +1,7 @@
This is makeindex, version 2.15 [TeX Live 2011] (kpathsea + Thai support).
Scanning style file ./output.ist...........................done (27 attributes redefined, 0 ignored).
Scanning input file output.glo....done (1 entries accepted, 0 rejected).
Sorting entries...done (0 comparisons).
Generating output file output.gls....done (6 lines written, 0 warnings).
Output written in output.gls.
Transcript written in output.glg.

View File

@@ -0,0 +1 @@
\glossaryentry{Physics?\glossaryentryfield{Physics}{\glsnamefont{Physics}}{is the study of stuff}{\relax }|setentrycounter[]{page}\glsnumberformat}{1}

View File

@@ -0,0 +1,6 @@
\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble
\begin{theglossary}\glossaryheader
\glsgroupheading{P}\relax \glsresetentrylist %
\glossaryentryfield{Physics}{\glsnamefont{Physics}}{is the study of stuff}{\relax }{\glossaryentrynumbers{\relax
\setentrycounter[]{page}\glsnumberformat{1}}}%
\end{theglossary}\glossarypostamble

View File

@@ -0,0 +1,29 @@
% makeindex style file created by the glossaries package
% for document 'output' on 2013-7-28
actual '?'
encap '|'
level '!'
quote '"'
keyword "\\glossaryentry"
preamble "\\glossarysection[\\glossarytoctitle]{\\glossarytitle}\\glossarypreamble\n\\begin{theglossary}\\glossaryheader\n"
postamble "\%\n\\end{theglossary}\\glossarypostamble\n"
group_skip "\\glsgroupskip\n"
item_0 "\%\n"
item_1 "\%\n"
item_2 "\%\n"
item_01 "\%\n"
item_x1 "\\relax \\glsresetentrylist\n"
item_12 "\%\n"
item_x2 "\\relax \\glsresetentrylist\n"
delim_0 "\{\\glossaryentrynumbers\{\\relax "
delim_1 "\{\\glossaryentrynumbers\{\\relax "
delim_2 "\{\\glossaryentrynumbers\{\\relax "
delim_t "\}\}"
delim_n "\\delimN "
delim_r "\\delimR "
headings_flag 1
heading_prefix "\\glsgroupheading\{"
heading_suffix "\}\\relax \\glsresetentrylist "
symhead_positive "glssymbols"
numhead_positive "glsnumbers"
page_compositor "."

View File

@@ -0,0 +1,26 @@
\documentclass{article}
\usepackage{pgfplots}
\usepackage{nopageno}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot +[no markers,
raw gnuplot,
thick,
empty line = jump
] gnuplot {
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 500;
splot x**3-3*x+3-y**2;
};
\end{axis}
\end{tikzpicture}
\end{document}

Binary file not shown.

View File

@@ -0,0 +1,13 @@
\documentclass{article}
\begin{document}
Hello world $x^2 = 0$.
%% chunk options: cache this chunk
%% begin.rcode my-cache, cache=TRUE
% set.seed(123)
% x = runif(10)
% sd(x) # standard deviation
%% end.rcode
\end{document}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=\textwidth]{image.eps}
\end{document}

View File

@@ -0,0 +1,3 @@
{
"compiler": "latex"
}

View File

@@ -0,0 +1,8 @@
\documentclass{article}
\usepackage{luacode}
\begin{document}
\begin{luacode}
tex.print("Hello world")
\end{luacode}
\end{document}

View File

@@ -0,0 +1,3 @@
{
"compiler": "lualatex"
}

View File

@@ -0,0 +1,12 @@
\documentclass{article}
\usepackage{makeidx}
\makeindex
\begin{document}
To solve various problems in Physics \index{Physics} it can useful to express any arbitrary piecewise-smooth function as a Fourier Series \index{Fourier Series} composed of multiple sine and cosine funcions.
\printindex
\end{document}

Binary file not shown.

View File

@@ -0,0 +1,10 @@
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
int main() {
printf("hello, world");
return 0;
}
\end{minted}
\end{document}

Binary file not shown.

View File

@@ -0,0 +1,15 @@
@book{DouglasAdams,
title={The Hitchhiker's Guide to the Galaxy},
author={Adams, Douglas},
isbn={9781417642595},
url={http://books.google.com/books?id=W-xMPgAACAAJ},
year={1995},
publisher={San Val}
}
@book{Tolkien,
title={The Hobbit},
author={Tolkien, J. R. R.},
year={1904?}
}

View File

@@ -0,0 +1,23 @@
\documentclass{report}
\usepackage{multibib}
\newcites{one}{First references}
\begin{document}
\chapter{First chapter}
The answer to life the universe and everything is 42 \citeone{DouglasAdams}
\bibliographystyleone{plain}
\bibliographyone{bibliography}
\chapter{Second chapter}
All that glitters is not gold \cite{Tolkien}
\bibliographystyle{plain}
\bibliography{bibliography}
\end{document}

View File

@@ -0,0 +1,8 @@
\begin{thebibliography}{1}
\bibitem{DouglasAdams}
Douglas Adams.
\newblock {\em The Hitchhiker's Guide to the Galaxy}.
\newblock San Val, 1995.
\end{thebibliography}

View File

@@ -0,0 +1,8 @@
\begin{thebibliography}{1}
\bibitem{Tolkien}
J.~R.~R. Tolkien.
\newblock {\em The Hobbit}.
\newblock 1904?
\end{thebibliography}

View File

@@ -0,0 +1 @@
\ref{two}

View File

@@ -0,0 +1,2 @@
\section{Two}
\label{two}

View File

@@ -0,0 +1,8 @@
\documentclass{article}
\begin{document}
\include{chapter1}
\include{chapter2}
\end{document}

View File

@@ -0,0 +1,9 @@
@book{DouglasAdams,
title={The Hitchhiker's Guide to the Galaxy},
author={Adams, Douglas},
isbn={9781417642595},
url={http://books.google.com/books?id=W-xMPgAACAAJ},
year={1995},
publisher={San Val}
}

View File

@@ -0,0 +1,10 @@
\documentclass{article}
\begin{document}
The meaning of life, the universe and everything is 42 \cite{DouglasAdams}
\bibliographystyle{plain}
\bibliography{bibliography}
\end{document}

View File

@@ -0,0 +1,8 @@
\begin{thebibliography}{1}
\bibitem{DouglasAdams}
Douglas Adams.
\newblock {\em The Hitchhiker's Guide to the Galaxy}.
\newblock San Val, 1995.
\end{thebibliography}

View File

@@ -0,0 +1 @@
This is chapter2.tex, included from main.tex. It's not in the same directory but can still be found.

View File

@@ -0,0 +1,10 @@
@book{DouglasAdams,
title={The Hitchhiker's Guide to the Galaxy},
author={Adams, Douglas},
isbn={9781417642595},
url={http://books.google.com/books?id=W-xMPgAACAAJ},
year={1995},
publisher={San Val}
}

View File

@@ -0,0 +1 @@
This is chapter1.tex, included from main.tex

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,19 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
Hello world, I'm in a subdirectory \cite{DouglasAdams}
\input{chapter1.tex}
\input{chapter2.tex}
\begin{centering}
\includegraphics[width=0.5\textwidth]{image.png}
\end{centering}
\bibliographystyle{plain}
\bibliography{bibliography}
\end{document}

View File

@@ -0,0 +1,7 @@
\documentclass[11pt]{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Zapfino.ttf}
\begin{document}
The quick brown fox jumps over the lazy dog
\end{document}

View File

@@ -0,0 +1,3 @@
{
"compiler": "xelatex"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB