Prevent LaTex code from showing in report - latex

In my markdown file I use the latex command
$$\pagebreak$$
to force a page break.
The page break works fine but the latex code also shows up in my report.
I want to let the code work but hide it in the report.
How can I do that?

The $$ tags are used to enter and exit math mode for writing equations. Since you are executing a typesetting command, you need to use \pagebreak without the $$ tags.
As noted in your comment, blank lines around the tag are necessary.

Related

Sphinx cross-reference in LaTeX

I have the following reference identified in file A:
.. _my-label:
and I reference it in file B :
this is a reference to file A :ref:`my-label`
This generates a cross-reference as expected when outputting HTML. However, when outputting LaTeX, it does not and I have the classical warning:
LaTeX Warning: Hyper reference `my-label:my-label' on page XX undefined on input line YY.
Is there a LaTeX trick like double compilation or something similar that I am not doing correctly?
I encountered the same issue. HTML compiled without errors for me, but LaTeX compilation did throw the hyperref errors you described. It seems to me that, for some obscure reason, Sphinx does not create the labels that hyperref tries to reference.
I came up with the following solution: since I do not know how to include the missing labels, I will just make it so that LaTeX does not look for them anymore. In detail, I am doing this by overwriting the \hyperref command.
I included the following code in my conf.py file:
latex_elements = {
'preamble': r'''
\renewcommand{\hyperref}[2][]{#2}
'''
}
This includes the \renewcommand{... in the preamble of the LaTeX document created by Sphinx. It will overwrite the \hyperref command so that it won't try to insert a link, but just print the link text.
Obviously, with this solution, the reference that caused the errors will not appear as hyperlinks in your PDF document, but at least it is compiling without errors.
Note
What I described worked perfectly fine for my use case, however, it is described in the Hyperref manual that the \hyperref command can be invoked in two different ways (\hyperref{URL}{category}{name}{text} and \hyperref[label]{text}). I am only overwriting the second one, as that seems to be the one that Sphinx is using for cross references. However, not accounting for the first one when overwriting the command might lead to issues in some cases.

Mathjax does not render colorbox correctly

I try to render \colorbox{yellow}{\sigma} and configurate the mathjax following http://docs.mathjax.org/en/latest/tex.html), but it just does not work.
Result:
Configuration I find from http://docs.mathjax.org/en/latest/tex.html (I tried with and without autoload-all.js, both don't work):
It looks like the same issue here on https://tex.stackexchange.com/
The problem here is that \colorbox reverts its argument back to text mode
Then you should write:
\colorbox{yellow}{$\sigma$}
Convenient sites to test your syntax:
http://quicklatex.com/
(add \usepackage{color} in the Custom LaTeX Document Preamble option to test colors)
and
here for Tex supported by mathjax.
Note: as \colorbox is displayed in red perhaps the command is not recognized, which means that your configuration contains errors. You can test with the macro require and write
\require{color}\colorbox{yellow}{$\sigma$}

Doxygen COMPACT_LATEX seems to generate incorrect Latex

I am trying to generate Latex output from Doxygen (1.8.9.1) on Windows 7 with DoxyWizard. My code is a small Python class and I just want the few pages that describe the class and its members or methods. Doxygen and Latex work fine but generate lots of empty or nearly empty pages (save a tree!).
When I set COMPACT_LATEX=YES then the first line of refman.tex becomes \documentclass[twoside]{article} . When I run the Make.bat (which in turn runs the Makefile), the Latex processing halts with:
! Undefined control sequence.
l.132 \backmatter
This is telling me that the article class is not expecting the usual front/back matter that would go in a book. With COMPACT_LATEX=NO, the first line is \documentclass[twoside]{book} and of course it runs fine but generates those extra pages.
Is there a way to suppress the backmatter in the Latex output when running with COMPACT_LATEX=NO ?
Perhaps this is a bug in Doxygen?
Thanks
--Louis

Change format of inline code evaluation in org-mode's LaTeX-export

I have a code block in an org document
#+NAME: result_whatever
#+BEGIN_SRC python :session data :results value :exports none
return(8.1 - 5)
#+END_SRC
which I evaluate inline:
Now, does this work? Let's see: call_result_whatever(). I'd be surprised ...
When exporting to LaTeX, this generates the following:
Now, does this work? Let's see: \texttt{3.1}. I'd be surprised \ldots{}
However, I don't want the results to be displayed in monospace. I want it to be formatted in "normal" upright font, without any special markup.
How can I achieve this?
You should be able to get it work using the optional header arguments which can be added to call_function().
I don't have LaTeX installed on this system so can't fully test the outputs to ensure they come out exactly as desired, I'm using the plain text output to compare instead. However you can use the following syntax as part of your call to modify the results.
Now, does this work? Let's see call_results_whatever()[:results raw].
I'd be surprised ...
Without the [:results raw] the output to Plain Text (Ascii buffer) is Let's see `3.0999999999999996'.. With the added results it becomes Let's see 3.0999999999999996.
For full details of the available results keywords as well as other optional header arguments for the inline blocks please see Evaluation Code Blocks and Results arguments.
this is 5 years later. apparently in org-mode 8.2 or so, a new variable was introduced (documenting in "Evaluating Code Blocks" in the org-mode manual, but this from etc/ORG-NEWS in the source tree):
*** New option: org-babel-inline-result-wrap
If you set this to the following
: (setq org-babel-inline-result-wrap "$%s$")
then inline code snippets will be wrapped into the formatting string.
so, to eliminate \texttt{}
(setq org-babel-inline-result-wrap "%s")
The problem of this type can be solved in two ways:
1: Easy does it:
A plain query-replace on the exported buffer.
Once you're in the LaTeX buffer,
beginning-of-buffer or M-<
query-replace or M-%
enter \texttt as the string that you want to replace
enter nothing as the replacement
continue to replace each match interactively
with y/n or just replace everything with !
2: But I wanna!
The second way is to nag the org-mode mailing list into
implementing a switch or an option for your specific case.
While it's necessary sometimes, it also produces a system
with thousands of switches, which can become unwieldy.
You can try, but I don't recommend.

extra "file://" prefix generated by pdflatex using hyperref package in macro

The LaTeX hyperref package confuses me in several ways. Here's my particular problem.
In my document, the command
\footnote{
\url{http://www.boston.com/news/science/articles/2010/04/25/new_atlas_shows_the_state_of_nature_as_well_as_the_nature_of_states/}
}
works just fine - pdflatex generates just the valid link.
But the commands
\newcommand{\webref}[1]{\footnote{\url{#1}}}
\webref{http://www.boston.com/news/science/articles/2010/04/25/new_atlas_shows_the_state_of_nature_as_well_as_the_nature_of_states/
}
generates the link
file:///C|/eb/qrbook/%20http://www.boston.com/news/science/articles/2010/04/25/new_atlas_shows_the_state_of_nature_as_well_as_the_nature_of_states/
Can someone tell me where the extra "file://..." comes from, and how to get rid of it?
Wild guess: Are you sure you're not introducing any extraneous spaces anywhere? I can reproduce the behaviour if I introduce a linebreak just before #1. (Pro tip: Put a % just after the last character in multi-line commands, so LaTeX doesn't process the newline.)

Resources