I hope there is a simple solution: I need a latex macro that ignores specific text from a tex-script. E.g.:
\begin{ignoretext}
bla bla
hello
\end{ignoretext}
Should compile to
hello
Thanks in advance :)
Pythontex package
I achieved the result through the pythontex package. I'm assuming that you will search and install the compiler/package required for your system, in such a way you can run the following example.
This is a minimal example of what you are searching for:
\documentclass{article}
\usepackage{pythontex}
\newcommand{\ignoretext}[2]{\pyc{%
ret = r"#2".replace(r"#1", r'');%
print(ret);%
}}
\begin{document}
\ignoretext{bla bla}{
bla bla
Hello
}
\end{document}
This document (test.tex) must be compiled with:
pdflatex test.tex
pythontex test.tex
pdflatex test.tex
The result contains only
Hello
The macro works as follow:
First argument contains the text to remove
Second argument is your actual text
Comment package (bad answer)
It works with the comment package if you write your code in this way:
\begin{comment}
bla bla
\end{comment}
hello
it must be included in the preamble (\usepackage{comment}).
Related
I would like to use reveal-code-focus within org-mode in Emacs (https://bnjmnt4n.github.io/reveal-code-focus/#/reveal-code-focus). Is there an example that someone could walk me through on how to do it? I have looked and looked but not found any help.
#+BEGIN_SRC python :results output
import random
random.seed(1)
print("Hello World! Here's a random number: %f" % random.random())
#+END_SRC
In the above example I want the background color for random.seed(1) to be highlighted when exporting to HTML using reveal.js.
Please note that, it is not for syntax highlighting but for code focus.
I have an org document with tags. However, when exporting it, the tag name is also exported. Is there a way to hide the tag name in the exported document?
#+TITLE: tag issue
#+AUTHOR: someone
* First section
** sub
bla bla bla
** second :incomplete:
bla
Exported document:
You can define how you want to export tags thanks to the org-export-with-tags variable:
org-export-with-tags is a variable defined in ‘ox.el’. Its value is t
This variable is safe as a file local variable if its value
satisfies the predicate which is a byte-compiled expression.
Documentation: If nil, do not export tags, just remove them from
headlines.
If this is the symbol ‘not-in-toc’, tags will be removed from table of
contents entries, but still be shown in the headlines of the document.
This option can also be set with the OPTIONS keyword, e.g. "tags:nil".
In your case if you do not want to export tags, simply use the option:
#+OPTIONS: tags:nil
Your complete example is thus:
#+OPTIONS: tags:nil
#+TITLE: tag issue
#+AUTHOR: someone
* First section
** sub
bla bla bla
** second :incomplete:
bla
(before exporting with C-e C-c p o, do not forget to type C-c C-c over the line #+OPTIONS: ... to tell to emacs to refresh the setting)
You will get:
note: you can find other useful options here
In emacs org-mode, is it possible to apply markup to the RESULTS section of a SRC block output when exporting to PDF (or any export format)?
For example, here is a src code block:
#+BEGIN_SRC python :results output :exports both
print '*I would like this line to be bold*'
#+END_SRC
#+RESULTS:
: *I would like this line to be bold*
The RESULTS section is generated by the usual C-c C-c.
Normally org-mode will mark up text in * as bold, but it obviously doesn't do this if that text is in a RESULTS block (or, it appears in a SRC block). In my example, if I export this (PDF via Latex) then I just get the exact output of
*I would like this line to be bold*
...there's no markup.
Answering my own question.
There are formatting modifiers you can add in the header section of the SRC block to do what I want. One of them is 'raw'.
#+BEGIN_SRC python :results output raw
print '*I would like this line to be bold*'
#+END_SRC
#+RESULTS:
*I would like this line to be bold*
(Ironically on Stack Overflow I'm not sure how to mix code blocks and bold face, but the bold line is the result of running the code block in org-mode).
There is a full list of ways to format output here:
http://orgmode.org/manual/results.html#results
I would like to create an Emacs-mode that behaves the following way:
When starting a new paragraph, Emacs asks in a buffer window, which
template to use:
buffer window:
1 - standard (default)
2 - person
3 - insertion
4 - location
5 - header
Just <ENTER> selects 1 - standard (default).
Whenever two captital letters are put in, everything till the next space
or line ending should be in capitals:
PErson -> PERSON
PErson NAmed CHuck -> PERSON NAMED CHUCK
The standard-template works something like this:
A standard paragraph starts with a person. After the person, there may or
may not follow some ():
If (), then follows a line break:
input (note the missing <SPACE>):
PErson(doing something).bla bla bla.
output:
PERSON <i>(doing something)</i>.
bla bla bla.
If no ():
input:
PErson.bla bla bla.
output:
PERSON. bla bla bla.
For demonstrating what should happen depending on the chosen template,
here are some sample inputs:
Choose "1 - standard" + input:
PErson(doing something. Something else. Something else).bla bla
bla<ENTER>bla bla bla<ENTER>bla bla bla.<ENTER><ENTER>
should become:
output:
<standard>PERSON <i>(doing something. Something else. Something else)</i>.
bla bla bla
bla bla bla
bla bla bla.</standard>
Choose "2 - person" + input:
Description of a place. PErson NAmed CHuck walks around the corner.<ENTER>
output:
<person><i>Description of a place.</i> PERSON NAMED CHUCK <i>walks around
the corner.</i></person>
Choose "3 - insertion" + input:
Something happens. Something can be heard. Something can be seen.<ENTER>
output:
<insertion><i>(Something happens. Something can be heard. Something can be
seen.)</i></insertion>
Note:
Depending on the selected template, a paragraph ends with <ENTER> or
<ENTER><ENTER>.
The final markup file (html, xml, whatever) should be used in LibreOffice
for further processing.
I already wrote an Emacs mode some time ago. Very simple thing. But with
this here, I would be grateful for every hint you can offer.
It looks like you're trying to write a mode for screenwriting.
Instead of writing your own, maybe give Fountain Mode a shot:
Fountain Mode aims to be a full-featured screenwriting environment for GNU Emacs using the Fountain markup format. For more information on the Fountain markup format, visit http://fountain.io.
Fountain Mode can be installed via MELPA or MELPA stable. Here's a screenshot from its GitHub page:
(source: paulwrankin.com)
I have a question.
I have a mainpage in Doxygen documentation, inside which, the end comment delimiter "*/" is in a comment, and that is where Doxygen stops generating the page, because it thinks that is the end of it. How can I make Doxygen copy it without processing it?
It looks something like this:
/**
#mainpage
The end comment delimiter in Doxygen is */
... bla bla bla...
**/
Here I should mention that I have already tried #code and #verbatim, but those are making code blocks, which I do not desire.
Thanks in advance!
It is also a bit of a hack, but for HTML and LaTeX output you could use
/**
#mainpage
The end comment delimiter in Doxygen is \endcomment
... bla bla bla...
**/
Along with the following alias definition in the config file:
ALIASES = endcomment="\htmlonly*/\endhtmlonly\latexonly$\ast$/\endlatexonly"
The following seems to work (for C# at least):
/**
#mainpage
The end comment delimiter in Doxygen is
**/
/// */ \n
/**
... bla bla bla...
**/
The /// continues on the previous comment, but as it's not started with a /**, the */ is not taken to be the end of that comment. The \n is to put the ... bla bla bla... on a new line.
EDIT
This works for a doxygen comment for a construct within the program (like a class or enum), but not in the #mainpage section.
SECOND EDIT
Using only single-line comments, and setting the MULTILINE_CPP_IS_BRIEF flag now seems to work with the mainpage section
/// #mainpage
/// The end comment delimiter in Doxygen is */
/// ... bla bla bla...
This obviously means that you'll need to use the /// comment style, at least for the main page section, but that seems like the only option (unless * / is a viable option :P)