Error setting up the LATEX fancy header - inconsistent results - header

I have a question regarding the fancy header in Latex. The header shows up inconsistently with the following code (e.g. doesn't show the section name for the Abstract; isn't showing at all on the first page of table of contents etc)
My code:
%from settings
\pagestyle{fancy}
\fancyhf{}
\rhead{\thepage}
\lhead{\nouppercase\leftmark}
%code Abstract
\pagenumbering{roman}
\thispagestyle{fancy}
\section*{Abstract}
\lipsum[1]
\phantomsection
\addcontentsline{toc}{section}{Abstract}
%code Table of Content
\newpage
\phantomsection
\renewcommand{\contentsname}{Table of Contents}
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents\thispagestyle{fancy}
Thanks a lot

Related

tcolorbox in RMarkdown with shortcuts

I'm using the LaTex library tcolorbox in a RMarkdown document to list R code with tbclisting{...}. It works fine when I use the full command is used in the document
\begin{tcblisting}{colback=red!5!white, colframe=red!50!black,listing only,before skip=5 cm,
title=R code for finding and plotting frequencies from sorted data - Figure 3.5,hbox, enhanced, drop fuzzy shadow, listing options={language=R,keywordstyle=\color{blue}},before=\begin{center}, after=\end{center}}
some text
\end{tcblisting}
Due to the length of the command and the multiple use of similar boxes, changing each box to reflect, say, a new color, is tedious and error prone. I'd like to create a short cut using
\newtcblisting{mybox}[1]{%colback=red!5!white, colframe=red!50!black,listing only,before skip=5 cm,title={#1},hbox, enhanced, drop fuzzy shadow, listing options={language=R,keywordstyle=\color{blue}}, before=\begin{center}, after=\end{center}}
in the preamble as in the LaTex documentation, then implemented using
when I refer to the predefined box using
\begin{mybox}{my box title}
some text
\end{mybox}
but the compiler-to-pdf gives me an error message
**!Package pgfkeys Error: I do not know the key '/tcb/[' and I am going to ignore it. Perhaps you misspelled it.**
I'm thinking that 1) RMarkdown/tcolorbox doesn't support this or 2) something is wrong with my syntax. For 2) I've tried putting the newtcblisting definition in the preamble header-includes: section with the "-" preceding it (no good) and in the main body of the document w/o the "-". Also no good.
Can anyone help with this?

How to remove header in latex?

I only want to keep the page number at the bottom and nothing header.But using the following commands I am still getting chapter name and section in the header
\pagestyle{fancy}
\renewcommand\headrulewidth{0pt}
\lhead{}\chead{}\rhead{}
\cfoot{\vspace*{1.5\baselineskip}\thepage}
Thanks in advance
\pagestyle{plain} should take care of that. For single pages \thispagestyle{plain}
http://www.ctex.org/documents/packages/layout/fancyhdr.pdf
The fancyhdr doc explains the problem.
Some LATEX commands, like \chapter, use the \thispagestyle command to automatically switch
to the plain page style, thus ignoring the page style currently in effect. To customize even such
pages you must redefine the plain pagestyle.
And it suggests
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\bfseries \thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

Netsuite PDF Templating: get number of pages as attribute

I am templating pdfs in Netsuite using freemarker and I want to display the footer only on the last page. I have been doing some research, but couldn't find a solution (since looks like the environment does not allow me to include or import libs), so I thought that just comparing the number of the page with the total pages in an if tag would be a nice and easy workaround. I already know how to display the numbers by using the <pagenumber/> and <totalpages/> tags, but still cannot get them as values so I can use them like this:
<#if (pagenumber == totalpages) >
... footer html...
</#if>
Any ideas of how or where can I get those values from?
The approach you are trying won't work, because you are mixing BFO and Freemarker syntax. Netsuite uses two different "engines" to process PDF Templates. The first step is Freemarker, which merges the record fields with your template and produces an XML file, which is then converted by BFO into a PDF file. The <totalpages/> element is meaningless to Freemarker, as it is only converted into a number by BFO later.
Unfortunately, the ability to add a footer to only the last page of a document is currently a limitation of BFO, as per the BFO FAQ:
At the moment we do not have a facility for explicitly assigning a
footer or header to the last page in a document when the number of
pages is unknown.
You CAN add it after a page break - and put the page break at the end of the body
<pbr footer="nlfooter" footer-height="25%"></pbr>
</body>
The issue here is - on a one page output - you will get 2 pages minimum... it will always ADD a page for the disclaimer / footer...

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 detect a section in a wikimedia page dump

I have looked around quite a bit to try and answer this question, but to no avail. I am parsing wikimedia page dumps to process certain pages (yes, I am aware of several tools to parse wikimedia page dumps, but they don't work for me as well as my parser).
Question is simple. I know how to detect start of a section (e.g. "==External References=="). That's easy. What's not well defined is how to detect when a section ends? For example, for most sections I can scan until start of next section header, but that isn't reliable. I looked at wikimedia's help page on sections, but it doesn't say how to detect end of a section.
There is no "section end" marker in MediaWiki syntax. A section extends until the next section header of the same or lower level. (There is also a "section 0" containing all the text before the first section header.)
Yes, this implies that sections at different levels can overlap, as in this example:
This text is in section 0.
== Section 1 begins here ==
This text is in section 1.
=== Section 2 begins here ===
This text is in sections 1 and 2.
=== Section 3 begins here ===
This text is in sections 1 and 3.
== Section 4 begins here ==
This text is in section 4.
Note that headings created using the HTML <h1>, <h2>, etc. tags don't begin or end sections, and won't have section edit links, even though they look otherwise identical to section headings.
Section headings inside templates do get section edit links, which let you edit the corresponding section of the template, but they're treated specially and are not considered part of the normal section structure of the containing page. There are also some weird special cases here involving section headers inside template parameters which I don't fully remember off the top of my head.
The automatically generated first level heading at the top of every page also doesn't count as a section heading, although any extra first level headings created with = Heading = do.