Hiding a section from output and table of contents

Hi AmberV,

I have a page that is required in my project in order the process a number of LaTeX commands that I am unable to combine with other pages.

The only text that appears on the page is the word ‘Glossary’, from the Binder title. There is no header or footer on the page.

I’d like to NOT have the page appear in the Table of Contents, and preferably NOT appear in the printed PDF output file at all.

If the page were blank, I could eliminate the blank page using the LaTeX emptypage package. Given that the word ‘Glossary’ appears on the printed PDF page, however, I haven’t found a way to eliminate this page using LaTeX.

Is there a way I can eliminate the page from the PDF output using Scrivener ?

Thanks,
scrive

I’ve split this off since it does not have to do with hiding a section from an ebook using the conventional compile path.

I’d like to NOT have the page appear in the Table of Contents, and preferably NOT appear in the printed PDF output file at all.

That part is just \chapter*{Glossary}, right?

As for hiding it completely, I’m not sure what you’re going for there. It seems like you’re asking two questions where one would do: if something isn’t a part of the document at all, then why would it be in the ToC?

As for hiding a component of your draft folder from output completely, that’s what the Include in Compile checkbox is for.

1 Like

Hi AmberV,

It took me a short while, but I stumbled on a solution to my question. For some reason, I looked at the list of Section Types and found one that apparently was carried along from the original General Non-Fiction (LaTeX) project from which I began my LaTeX project: LaTeX Chunk.

So, I tried setting the Section Type for the ‘Glossary’ section to LaTeX Chunk, and recompiled. It worked! The ‘Glossary’ section no longer appears either in the Table of Contents or in the printed PDF.

And, the page numbers behaved as they should with no skipping of page numbers.

Apologies for posting an issue before I had a chance to fully flesh out all possible solutions, but the thought of a Section Type as a possible solution didn’t occur to me until after I posted. My bad …

As for using the Include in Compile checkbox to turn off compiling the section to eliminate the section from the TOC and PDF, the code in the ‘Glossary’ section needed to be compiled as to be used as part of the LaTeX code in the final project. That is why I was having such a hard time figuring out how to compile the section without having it appear in the TOC and PDF.

Whomever originally assembled together the original General Non-Fiction (LaTeX) project apparently had in mind just such a situation where someone might need to compile LaTeX code without having the section actually show up in the TOC or PDF. I guess that is why they named the Section Type LaTeX Chunk!

Nice forethought!

Thanks,
scrive
:thinking:

1 Like

Thanks for the clarification, I better understand what you mean, I got hung up on it not being a part of the “output” at all and was confused by that. To my mind that means everything, including invisible instructions, but I see you were meaning it in the sense of being visible when it needed to be invisible in the PDF, but not the .tex file that made it.

And yup, the “LaTeX Chunk” layout is precisely for that kind of stuff, it is used by the contents of the front and back matter folders in that template, but can be used wherever you need to insert typesetting or flow instructions within the draft as well.

1 Like

Hi AmberV,

If I’m not mistaken, I believe it is you I need to thank for including the LaTeX Chunk in the General Non-Fiction (LaTeX) template, as the author of same.

I apologize if my original posting was not clear as to what I was looking for.

When it is needed, the LaTeX Chunk is a crucial Scrivener component when building a LaTeX project. Thank you for your foresight!

Again, Scrivener comes through where and when it needs to !

Now, if I can just figure out how I can create a MWE (minimum working example) from my ~ 600page (with +18K lines of code) project for when I need to post a LaTeX issue on StackExchange?!

Thanks again,
scrive
:thinking:

You’re quite welcome, glad it has been helpful to you.

In fact, I just double-checked and there is also a document template for adding these easily (called “LaTeX Control File”, from the Project ▸ New from Template submenu). That sets the icon as well as the section type to “N/A”, and has some boilerplate in a comment that you will probably want to edit out of the original template file.

1 Like

Hi AmberV,

Thank you for that tidbit of information. There is so much I still need to learn about Scrivener+LaTeX after these 2+ years!

I realize that this is not a strictly Scrivener issue, but any tidbits you may have to offer to enable a Scrivener+LaTeX user to construct a MWE, I’d be forever grateful (note that I already am!).

Thanks again, and again, and again …
scrive
:thinking:

It’s easy to hide sections from the Latex table of contents, if needed. See, e.g., here: sectioning - Hide sections of specific chapter from table of contents - TeX - LaTeX Stack Exchange

And if I just want to hide a chunk of text from the pdf, I comment it out with a % before the paragraph.

But maybe I’m not understanding your issue right.

1 Like

Hi atiz,

Thanks for your posting … it may be a bit strange to be looking for a set of code to be executed in a project without having the chapter/section/subsection heading nor any part of the code appear in the PDF output, but that is exactly what I needed.

The code included a few instances of the \printglossary command that I needed to execute at a specific point in the compilation of the Scrivener+LaTeX code so that all the Glossaries were properly positioned in the PDF output.

I realize that this may not be something that would be needed in a normal Scrivener project (without any LaTeX code) so I can understand any confusion my posting may have created. Heck, for two+ years I did not need to use the Latex Chunk Section type until I was in a position to begin addressing the annoying appearance of the Scrivener section in the Table of Contents and the PDF output where the LaTeX code resided.

I was fortunate that the designer of the General Non-Fiction (LaTeX) project template had the foresight to include the Latex Chunk Section type in the template along with so many other features that allowed me to even create my Scrivener+LaTeX project. Without that initial project template I would likely have dropped Scrivener as a app for my project and pursued another direction.

Thanks again for your posting,
scrive
:thinking:

I’m not sure I entirely understand the setup, but of course most are pretty complicated, so that’s fine.
I wanted to see what the Latex Chunk section type does, but I don’t seem to have that in the General Non-Fiction (Latex) template. (I’m using the latest Scrivener, on Mac, and just started a brand new test project with that template – what could be the reason?)
So what does that section look like after compile, in the latex file?

I have a fair amount of latex code in my Scrivener project (and used to have more, before discovering what Styles can do…). I just “comment out” whatever I don’t want to show up in the final pdf output (in fact, now have a style for that! the “comment-out” style).

1 Like

It’s not a section type, just set your section type to “N/A” for any section that shouldn’t be adding functional LaTeX to or around it (to make it a chapter, section or whatever).

As I noted above, there is a document template that has everything set up the way it should be.

So what does that section look like after compile, in the latex file?

Exactly what you typed into the editor, no more and no less.

2 Likes