sphinx remove chapter title in my pdf with latexpdf? - pdf

I generate a documentation from rst to pdf with latexpdf and sphinx.
How can I remove chapter title before every chapter?
-----------
CHAPTER ONE
-----------

As noted in the sphinx documentation you can change the latex_documents documentclass to a howto documentclass, which will get rid of the "Chaper" before your section. However, this will also change formatting slightly for the whole build.
documentclass: Normally, one of 'manual' or 'howto' (provided by Sphinx). Other document classes can be given, but they must include the “sphinx” package in order to define Sphinx’ custom LaTeX commands. “howto” documents will not get appendices. Also, howtos will have a simpler title page.
Just edit your conf.py and change manual to howto.
latex_documents = [
('index', 'foo.tex', u'foo Documentation',
u'bar', 'howto'),
]

As for the Chapter titles, from the Sphinx documentation and LaTeX customization:
Inclusion of the “fncychap” package (which makes fancy chapter
titles), default '\usepackage[Bjarne]{fncychap}' for English
documentation, '\usepackage[Sonny]{fncychap}' for internationalized
docs (because the “Bjarne” style uses numbers spelled out in English).
Other “fncychap” styles you can try include “Lenny”, “Glenn”, “Conny”
and “Rejne”. You can also set this to '' to disable fncychap.
latex_elements = {
'fncychap': '\\usepackage[Conny]{fncychap}',
# ...
}
Also, I was trying to search for how to remove the Title page, and a search brought me here, so I thought I'd add my answer here.
To remove the title page, just set the following options:
latex_elements = {
'maketitle': '', # No Title Page
# ...
}

Related

In Docusaurus, is there can I preserve capitalization in anchors created from headings in docs?

I'm using Docusaurus to publish documentation for an open source library's API. The headings of my source markdown files correspond to the names of methods and properties for classes in the library. This all works fine.
However, the anchors that are created in the HTML are all lowercase. I want them to respect the capitalization used in the markdown file.
For example, this markdown header:
###.doSomething()
Generates the following HTML:
<h3>
<a aria-hidden="true" tabindex="-1" class="..." id="dosomething"></a>.
<code>.doSomething()</code>
<a class="..." href="#dosomething" title="...">#</a>
</h3>
As you can see, camelCase is transformed to lowercase. I would like to keep capitalization intact. Is it possible?
P.S. The markdown files are automatically generated from jsdoc comments. In jsdoc, links to a method or properties include capitalization.
TL;DR
Inside your project, navigate to the directory node_modules > github-slugger;
Open the index.js file;
Remove the line if (!maintainCase) string = string.toLowerCase()
The function will become something like this:
function slugger (string, maintainCase) {
if (typeof string !== 'string') return ''
// if (!maintainCase) string = string.toLowerCase() <-- remove this!
return string.trim()
.replace(specials, '')
.replace(emoji(), '')
.replace(whitespace, '-')
}
IMPORTANT!
If you update the docusaurus, you may need to apply this change again;
It may be necessary to edit the doc to see the changes, because of cache. Here I edited the doc file and it worked;
You must restart the docusaurus service after you make this change. And probably needs to clear the cache with npm cache clear --force;
Also, I think you should delete the folder .docusaurus to force the rebuild of all documents.
RESULT
The .md file:
---
id: intro
---
# Random title
### WriNTinG with CaSeS
test 1
### .doAnotherThink()
test 3
### .doCamelCaseWithSeveralLETTERS()
test 3
ROADMAP
I must say that this one was hard. First I tried to track down the anchor tags, then the description. Eventually I found about the github-slugger, and looked like that was the way.
But once I made the changes, nothing had happened to the document! So after hours trying, I gave up… Then, just for curiosity, I decide to see what the slug function did to the document, by adding a second header with the same name. And — luck! — it kept the original case.
It turns out that you can simply use explicit IDs to solve this issue: https://docusaurus.io/docs/next/markdown-features/headings#explicit-ids

How do you add a "general info" section to an NSwag generated API document website?

Our current method uses a manually maintained and formatted YML document. At the beginning is a lengthy introduction/instruction section that I would like to include in generated documentation. The swagger docs suggest that I can add a markdown compatible, multi-line description but that's not really something I want to do in my Startup.cs file. How can I add this sort of extended introduction?
An example of the what I'm looking to do is shown on docs.discourse.org which is generated using Redoc.
I would suggest placing your API introduction to a static file that is copied to build output, then configure open api document to read it.
The file can contain HTML markup or markdown. I tend to use markdown to get heading links appear in the sidebar in redoc, it is completely up to you.
services.AddOpenApiDocument(document =>
{
document.Description = File.ReadAllText("Docs/Description.html");
// other properties
document.AddSecurity("Bearer", Enumerable.Empty<string>(), new OpenApiSecurityScheme
{
Type = OpenApiSecuritySchemeType.ApiKey,
Name = "Authorization",
In = OpenApiSecurityApiKeyLocation.Header,
Description = File.ReadAllText("Docs/Authentication.html")
});
document.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("Bearer"));
});

How do I force Pelican to suppress generation of category files?

I don't want Pelican 3.6 to generate:
/author/
/category/
/tag/
/archives.html
/authors.html
/categories.html
/tags.html
DIRECT_TEMPLATES can be set to suppress some of the index files:-
# DIRECT_TEMPLATES = ['index', 'categories', 'authors', 'archives']
DIRECT_TEMPLATES = ['index']
Omitting tag metadata in source content files will prevent generation of the tag folder and index; omitting author metadata and the AUTHOR setting will prevent generation of the author folder and index.
But it seems that suppressing category isn't so simple. I've tried setting DEFAULT_CATEGORY to an empty string, but this results in errors and no output for sources with no category metadata:-
Skipping <some_file>: could not find information about 'NameError: category'
I've also tried removing the relevant template files from the theme being used, but this merely causes them to be replaced with the matching template in the built-in "simple" theme.
Am I missing an established method of suppressing category generation?
The URL settings documentation has a long list of settings, including several […]_SAVE_AS settings. Directly below the URL settings table is a note that answers your question: for any page type that you do not want generated, set the corresponding […]_SAVE_AS setting to ''. For example, to suppress individual category page generation, add this setting:
CATEGORY_SAVE_AS = ''

LyX -- Title, Abstract, Keywords Missing When Using Elsevier Class in View

I'm pretty new to using LyX, but have looked around this forum, as well as others and haven't found anyone else who has encountered this problem.
The issue is that, when I click on the 'eyes' to preview my document in .pdf form, there are the two numbered sections with the corresponding body text, but my title, abstract, and keywords, as well as the 'new page' formatting, are all missing; the two sections are at the top of the page as though they had never been included.
Some pertinent information:
LyX has recently been installed (last couple of weeks)
I'm running OSX 10.9.5
My version of LyX is 2.1.3
I'm using the Elsevier document class
The following is the TeX source:
% Preview source code
%% LyX 2.1.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[letterpaper,english]{elsarticle}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth
\makeatother
\usepackage{babel}
\begin{document}
\title{ This is where my title is }
\author{My name}
\begin{abstract}
Abstract: This is my abstarct.\end{abstract}
\begin{keyword}
Keywords: Keyword1, Keyword2, Keyword 3
\end{keyword}
\newpage{}
\section{Introduction}
My intro text
\section{Literature Review}
My body text
\end{document}
Thanks in advance for taking the time to read this and help out!
-Mike
Edit1: After adding \begin{frontmatter}{} and \end{frontmatter}{} before the title and after the keywords, things seem to be working (ie. the title, keywords, abstract and authors are all working) -- does the Elsevier document class force this to be used when denoting these items?
as suggested in the link below:
In the pulldown menu where you set your title text to be the Title, there's entries for BeginFrontmatter and EndFrontmatter. You need to put the first before your title and the second after your keywords.
In the pulldown menu where you set your title text to be the Title, there's entries for BeginFrontmatter and EndFrontmatter. You need to put the first before your title and the second after your keywords.
http://www.latex-community.org/forum/viewtopic.php?f=19&t=24933

How to generate rdoc-style collapsable code sections?

I am creating internal documentation for a C++ project using Doxygen. I am having Doxygen include the source for methods, etc., but this makes the page kind of hard to scan. I'd like it to behave like rdoc and hide the source in a block that is collapsed by default.
I thought that HTML_DYNAMIC_SECTIONS might let me do this, but alas, the changelog says that option only affects diagrams and graphs.
Maybe I could do it by editing the LAYOUT_FILE?
Anyhow, smart people, how can I coerce Doxygen to generate collapsable code sections?
if includ[ing] the source for methods, etc, [...] makes the page kind of hard to scan, why don't you just link to it (SOURCE_BROWSER = YES) instead of including it (INLINE_SOURCES = YES)? this would make the pages easier to scan and faster to load, and the source would still be accessible (at the expense of one more source page load). depends on how often you actually need to access the source, i guess.
that being said, there is a way to generate collapsible code sections (you will have to modify the source and recompile Doxygen, though):
collapsible sections in Doxygen's HTML output are marked with two nested <div>s like so:
<div class="dynheader"><div class="dynsection">
[collapsible section]
</div></div>
included code sections are marked like so: <div class="fragment"><pre class="fragment">...</pre></div>
thus, to make the included code sections collapsible, you have to either
modify the code that generates the <div class="fragment"><pre class="fragment">...</pre></div> to generate <div class="dynheader"><div class="dynsection">...</div></div> (and probably adjust some css), or
change the javascript initDynSections() function that scans and collapses the collapsible sections to recognize <div class="fragment"><pre class="fragment"> as one of them.
the implementation (or going the SOURCE_BROWSER route :)) is left as an exercise for the reader. good luck!
oh, and if you should succeed with a patch, it would be great if you could submit it to dimitri so that he can include it in a future version. thanks!
coming along here using the search engine of my choice i just want to leave a note here that it is not absolutely necessary to modify any doxygen source.
When this question was asked there was probably no possibility to embed pure html using the htmlonly tag but with this in mind one is able to create foldable container sections abusing a function named toggleVisibility
function toggleVisibility(linkObj)
{
var base = $(linkObj).attr('id');
var summary = $('#'+base+'-summary');
var content = $('#'+base+'-content');
var trigger = $('#'+base+'-trigger');
var src=$(trigger).attr('src');
if (content.is(':visible')===true) {
content.hide();
summary.show();
$(linkObj).addClass('closed').removeClass('opened');
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
content.show();
summary.hide();
$(linkObj).removeClass('closed').addClass('opened');
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
}
return false;
}
that is currently available every time the documentation is generated in a file called dynsections.js placed in the documentation root.
Regarding this code one gets to know the conditions to be able to create foldable code from his/her own documentation using Javascript avoiding inner execution faults in this function and preventing further javascript code from being uninterpreted.
dom element with a unique identifier id
another encapsulated dom element with unique identifier id-summary
another encapsulated dom element with unique identifier id-content
another encapsulated dom element with unique identifier id-trigger
the id-trigger element must contain a src attribute with at least 1 character
the class attributes of the main containers do not matter
With theese conditions in mind one can create the following code.
## Fold me
## <div id="example-div">
## <div id="example-div-summary"></div>
## <div id="example-div-content">
## <pre>
## foo
## bar
## </pre>
## </div>
## <div id="example-div-trigger" src="-"></div>
## </div>
## #htmlonly <script type="text/javascript">$("#example-div").ready(function() { toggleVisibility($("#example-div")); });</script> #endhtmlonly
The doxygen code above is used to document bash code using bash-doxygen so it might look a bit different from pure doxygen code. The first part involving the div containers is already described mentioning the conditions to fit the source of the function toggleVisibility and make it executable without any errors adjusting the doxygen comments for our needs.
The unique id prefix used in here is example-div. In line one there is a hyperref link setup to unfold a section using javascript directly in conjunction with some jQuery code.
What's left is the one liner at the end. It contains the jQuery script need to be run to initially fold the specific segment. For the bash-doxygen (and probably other languages) the block needs to be a one liner because of the script's block scope
Normally the contents between \htmlonly and \endhtmlonly is inserted as-is. When you want to insert a HTML fragment that has block scope like a table or list which should appear outside <p>..</p>, this can lead to invalid HTML. You can use \htmlonly[block] to make doxygen end the current paragraph and restart it after \endhtmlonly.
as noticed in the doxygen documentation and a comment below the right marked solution of the stackoverflow answer on including script tags in doxygen documentations.
Thank you for reading.
Hope this helps some people that come along here.