{"action":"opened","issue":{"url":"https://api.github.com/repos/fangohr/template-latex-paper-from-orgmode/issues/4","repository_url":"https://api.github.com/repos/fangohr/template-latex-paper-from-orgmode","labels_url":"https://api.github.com/repos/fangohr/template-latex-paper-from-orgmode/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/fangohr/template-latex-paper-from-orgmode/issues/4/comments","events_url":"https://api.github.com/repos/fangohr/template-latex-paper-from-orgmode/issues/4/events","html_url":"https://github.com/fangohr/template-latex-paper-from-orgmode/issues/4","id":380546933,"node_id":"MDU6SXNzdWUzODA1NDY5MzM=","number":4,"title":"All in one single org file","user":{"login":"dineshadepu","id":13584458,"node_id":"MDQ6VXNlcjEzNTg0NDU4","avatar_url":"https://avatars1.githubusercontent.com/u/13584458?v=4","gravatar_id":"","url":"https://api.github.com/users/dineshadepu","html_url":"https://github.com/dineshadepu","followers_url":"https://api.github.com/users/dineshadepu/followers","following_url":"https://api.github.com/users/dineshadepu/following{/other_user}","gists_url":"https://api.github.com/users/dineshadepu/gists{/gist_id}","starred_url":"https://api.github.com/users/dineshadepu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dineshadepu/subscriptions","organizations_url":"https://api.github.com/users/dineshadepu/orgs","repos_url":"https://api.github.com/users/dineshadepu/repos","events_url":"https://api.github.com/users/dineshadepu/events{/privacy}","received_events_url":"https://api.github.com/users/dineshadepu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-14T05:54:00Z","updated_at":"2018-11-14T05:54:00Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\n\r\nI did an alternate way of reproducing this. Basically we can use a single org file, and by using `C-c C-e` get the pdf.\r\n\r\n```\r\n#+LaTeX_CLASS: article\r\n#+OPTIONS: author:nil date:nil title:nil toc:nil\r\n#+OPTIONS: ^:nil\r\n\r\n#+LaTeX_HEADER: \\usepackage{booktabs}\r\n\r\n# % to include pdf/eps/png files\r\n#+LaTeX_HEADER: \\usepackage{graphicx}\r\n\r\n# % useful to add 'todo' markers\r\n#+LaTeX_HEADER: \\usepackage{todonotes}\r\n\r\n# % hyperrefs\r\n#+LaTeX_HEADER: \\usepackage{hyperref}\r\n\r\n# % ----------------- Code blocks ----------------\r\n# % nice source code formatting\r\n#+LaTeX_HEADER: \\usepackage{minted}\r\n#+LaTeX_HEADER: \\usepackage[utf8]{inputenc}\r\n\r\n#+LaTeX_HEADER: \\usepackage{listings}\r\n#+LaTeX_HEADER: \\usepackage{color}\r\n\r\n#+LaTeX_HEADER: \\definecolor{codegreen}{rgb}{0,0.6,0}\r\n#+LaTeX_HEADER: \\definecolor{codegray}{rgb}{0.5,0.5,0.5}\r\n#+LaTeX_HEADER: \\definecolor{codepurple}{rgb}{0.58,0,0.82}\r\n#+LaTeX_HEADER: \\definecolor{backcolour}{rgb}{0.95,0.95,0.92}\r\n\r\n#+LaTeX_HEADER: \\lstdefinestyle{mystyle}{\r\n#+LaTeX_HEADER:     backgroundcolor=\\color{backcolour},\r\n#+LaTeX_HEADER:     commentstyle=\\color{codegreen},\r\n#+LaTeX_HEADER:     keywordstyle=\\color{magenta},\r\n#+LaTeX_HEADER:     numberstyle=\\tiny\\color{codegray},\r\n#+LaTeX_HEADER:     stringstyle=\\color{codepurple},\r\n#+LaTeX_HEADER:     basicstyle=\\footnotesize,\r\n#+LaTeX_HEADER:     breakatwhitespace=false,\r\n#+LaTeX_HEADER:     breaklines=true,\r\n#+LaTeX_HEADER:     captionpos=b,\r\n#+LaTeX_HEADER:     keepspaces=true,\r\n#+LaTeX_HEADER:     numbers=left,\r\n#+LaTeX_HEADER:     numbersep=5pt,\r\n#+LaTeX_HEADER:     showspaces=false,\r\n#+LaTeX_HEADER:     showstringspaces=false,\r\n#+LaTeX_HEADER:     showtabs=false,\r\n#+LaTeX_HEADER:     tabsize=4\r\n#+LaTeX_HEADER: }\r\n\r\n#+LaTeX_HEADER: \\lstset{style=mystyle}\r\n# % ----------------- Code blocks ----------------\r\n\r\n# % change style of section headings\r\n#+LaTeX_HEADER: \\usepackage{sectsty}\r\n#+LaTeX_HEADER: \\allsectionsfont{\\sffamily}\r\n\r\n# % only required for orgmode ticked TODO items, can remove\r\n#+LaTeX_HEADER: \\usepackage{amssymb}\r\n\r\n# % only required for underlining text\r\n#+LaTeX_HEADER: \\usepackage[normalem]{ulem}\r\n\r\n# % often use this in differential operators:\r\n#+LaTeX_HEADER: \\renewcommand{\\d}{\\ensuremath{\\mathrm{d}}}\r\n\r\n# % allow more reasonable text width for most documents than LaTeX default\r\n#+LaTeX_HEADER: \\setlength{\\textheight}{21cm}\r\n#+LaTeX_HEADER: \\setlength{\\textwidth}{16cm}\r\n\r\n# % reduce left and right margins accordingly\r\n#+LaTeX_HEADER: \\setlength{\\evensidemargin}{-0cm}\r\n#+LaTeX_HEADER: \\setlength{\\oddsidemargin}{-0cm}\r\n\r\n# % reduce top margin\r\n#+LaTeX_HEADER: \\setlength{\\topmargin}{0cm}\r\n\r\n# % Increase default line spacing a little if desired\r\n#+LaTeX_HEADER: \\renewcommand{\\baselinestretch}{1.2}\r\n\r\n# % tailored float handling\r\n#+LaTeX_HEADER: %\\renewcommand{\\topfraction}{0.8}\r\n#+LaTeX_HEADER: %\\renewcommand{\\bottomfraction}{0.6}\r\n#+LaTeX_HEADER: %\\renewcommand{\\textfraction}{0.2}\r\n\r\n#+BEGIN_EXPORT latex\r\n\\title{\\sffamily \\textbf{Title -- template for orgmode latex production}}\r\n\r\n\\author{Hans Fangohr, Max Albert, University of Southampton}\r\n\r\n\\maketitle\r\n\r\n\\begin{abstract}\r\n  This is an abstract abstract, in the sense of only providing a\r\n  virtual abstract, also known as the interface. Somebody will have to\r\n  provide an inherited class that provides the real abstract.\r\n\r\n  We have placed the abstract in the paper.tex file, so that all the\r\n  content in the orgmode file \\texttt{content.org} is organised into\r\n  sections, and they can be unfolded, re-arranged, etc (the abstract\r\n  doesn't go well into a section because it appears even before the\r\n  first section starts). If you prefer, you can move the abstract\r\n  latex definition as is into the \\texttt{content.org} file, and all\r\n  will work as before.\r\n\\end{abstract}\r\n#+END_EXPORT\r\n* Introduction\r\n\r\nSome introduction to the topic. Orgmode is cool, see http://orgmode.org fore details. URLs are converted into hyperrefs automatically (i.e. no need to use the \\verb|\\href{}{}| command).\r\n\r\n* Method\r\n** This document\r\n\\label{sec:method}\r\n\r\nThe overall workflow is this: the main part of the paper is in the\r\nfile ~content.org~.\r\n\r\nThis is translated by an (Emacs) script into a full LaTeX document with\r\nname ~_content.tex~.\r\n\r\nAn extra (python) script strips off the LaTeX preamble and the\r\nlast few lines at the end of the document, and saves the\r\nremaining middle part of the document as ~content.tex~.\r\n\r\nThe main latex file is ~paper.tex~, which contains the latex\r\npreamble, all the style the requirements we or the journal may have,\r\nthe abstract, the bibliographystyle and bibliography uses the\r\n\\verb|\\input{content.tex}| command to include the autogenerated latex\r\ninto the main document.\r\n\r\nThere is a Makefile that automises all of these steps. It may be useful to run a pdf viewer that watches and automatically updates ~paper.pdf~ on any change, and to have a loop (or the ~watch~ command that repeatedly calls ~make~, so that the pdf is re-created when the modified ~content.org~ file is saved).\r\n\r\n** Subsections\r\n\r\nOur document may well contain subsections. In fact, part of the joy of orgmode is that we can re-arrange sections and change their depth quite easily.\r\n\r\n** Mention how to ignore a heading              :ignoreheading:\r\n\r\nUsing the ~:ignoreheading:~ tag, we can use section headings which do\r\nnot appear in the final document.\r\n\r\n** Say why this is useful                       :ignoreheading:\r\n\r\nThis is useful to 'label' paragraphs or sections to draft a document\r\nwhile not wanting to reveal that label/title in the final version to the\r\nreader.\r\n\r\n\r\n** Details\r\n\r\nWe can use equations as if the orgmode source was \\LaTeX{}, for example $f(x) = x^2$ or\r\n\\begin{equation}\r\n\\int f(x) \\d x = C\r\n\\end{equation}\r\n\r\n** Italics, bold, underline\r\n\r\nText can be emphasised using /italics/, *bold* or _underline_.\r\nIn org-mode these are written as ~/italics/~, ~*bold*~ and ~_underline_~.\r\n\r\n** COMMENT\r\n\r\nNote also the comment feature: sections that have titles starting with COMMENT are not included in the output, and can be used to record thoughts or drafts not to be shown in the LaTeX document.\r\n\r\n* Results\r\n** Tables\r\n\r\nTables are converted into tables:\r\n\r\n| name     |  # |\r\n|----------+----|\r\n| Apple    |  4 |\r\n| Pears    |  5 |\r\n| Tomatoes | 16 |\r\n\r\n\r\n** Figures\r\n\r\nFigures can be included like this\r\n\r\nfile:figures/icon.png\r\n\r\nOr we use the latex command directly:\r\n\r\n\\includegraphics[width=2cm]{figures/icon.png}\r\n\r\n\r\nWe can also provide guidance to orgmode how we would like the figure included (see http://orgmode.org/manual/LaTeX-specific-attributes.html for details):\r\n\r\n#+ATTR_LATEX: :width 2cm :options angle=90\r\nfile:figures/icon.png\r\n\r\nIf you prefer, you can inculde the full float figure environment as\r\nraw latex into the orgmode file. Here is an example for such a figure,\r\nand then we can refer to it through its figure number\r\n\\ref{fig:myfigure}.\r\n\r\n\\begin{figure}\r\n\\centering\r\n\\includegraphics[width=0.1\\columnwidth]{figures/icon.png}\r\n\\caption{The skyline\\label{fig:myfigure}}\r\n\\end{figure}\r\n\r\n** Figure and Table environments\r\n\r\nThe ~+CAPTION~ directive instructions orgmode to create a caption, and wrap up the following graphic or table into  a Table or Figure environment.\r\n\r\n#+CAPTION: This is the caption for the next table (or link)\r\n#+NAME:   tab:basic-data\r\n| Apples  | 1 |\r\n| Bananas | 3 |\r\n|---------+---|\r\n| Fruit   | 4 |\r\n\r\n#+CAPTION[Short form]: This is the caption for the next Figure\r\n#+NAME:   fig:example\r\n#+ATTR_LATEX: :width 2cm :options angle=90\r\nfile:figures/icon.png\r\n\r\nWe have just created figure \\ref{fig:example}.\r\n\r\n\r\n** Code\r\n\r\nWe can also include code. Again, it can be done directly from orgmode (and the option to also execute the code from within orgmode and include the output is exciting, but goes beyond the purpose of this template for document writing in orgmode. If you want to explore this further, look here: http://orgmode.org/manual/Working-with-source-code.html#Working-with-source-code\r\n\r\n\\begin{figure}\r\n\\footnotesize\r\n\\inputminted[bgcolor=white,frame=lines]{python}{code/example1.py}\r\n\\normalsize\r\n\\caption{An example script in Python. \\label{fig:code-example1}}\r\n\\end{figure}\r\n\r\nFigure \\ref{fig:code-example1} shows some code.\r\n\r\n** Include literal LaTeX\r\n\r\n#+LATEX: If necessary, we can use the \\verb|#+LATEX:| directive, to send a string directly to LaTeX, i.e. unmodified by orgmode.\r\n\r\n#+BEGIN_LATEX\r\nWe can also create a literal \\LaTeX{} block like this one.\\footnote{See \\href{http://orgmode.org/manual/Quoting-LaTeX-code.html}{http://orgmode.org/manual/Quoting-LaTeX-code.html} for more details}.\r\n#+END_LATEX\r\n\r\n** More results\r\n\r\nOf course we can cite work \\cite{authorX2016}.\r\n\r\n* Discussion\r\nComing back to the method outlined in section \\ref{sec:method}, it may\r\nwell be possible to achieve a similar setup without the Python script\r\nextracting the main part of the autogenerated document etc, and\r\ninclude all the required latex setup, extra packages, into special #+\r\ncommands in the orgmode file. However, I have found it efficient to be\r\nable to use journal latex templates directly, and thus came up with\r\nthis arrangement. Not perfect, but a functional start.\r\n\r\n* Summary\r\n\r\nI like using orgmode to author documents as the orgmode mark up is less intrusive (and overall fewer characters to type!) than the \\LaTeX{} mark up. Rearranging sections, and changing the depth (i.e. move sections to subsections etc) are trivial in orgmode. Overall, orgmode allows me to focus more on the content of the document and its structure.\r\n\r\n* Acknowledgements\r\nThanks to Sam Sinayoko for introducing me to his way of creating\r\nbeamer latex slides from orgmode, and who wrote the original elisp\r\nscript that executes the conversion of orgmode files to LaTeX. Thanks\r\nalso to Maximilian Albert, who helped tidying up the Makefile.\r\n\\newpage\r\n* TODO\r\nSometimes, a section with things to do is useful; with the understanding that this is completed and removed before the document is finished. (Or changed into a COMMENT section, so that it doesn't export to latex.)\r\n\r\nAn orgmode todo list (which can be nested) looks like this\r\n\r\n- TODO [2/3]\r\n  - [X] create github repository\r\n  - [X] write up the setup for this document\r\n  - [ ] Save planet [0/3]\r\n    - [ ] understand challenge\r\n    - [ ] find solution\r\n    - [ ] implement it\r\n\r\nbibliographystyle:unsrt\r\n#+BEGIN_EXPORT latex\r\n\\end{document}\r\n#+END_EXPORT\r\n```\r\n\r\nThis will simplify the code conversion, creating new files and many more."}}
{"actor":{"display_login":"dineshadepu"}}