How print correct display of front matter ?

I v used the template of non-fiction format for latex,and selected print and non-fiction manuscript,but the result of pdf of front and back matter,include table of contents ,did not display correct form。it look like below:

 \setcounter{page}{1} \pagenumbering{roman} 
\title{place} \author{yujian} \date{2022/3/1}
\begin{document}
 \maketitle \clearpage
---------------
\tableofcontents
% \listoffigures % \listoftables
----------------
\newpage \setcounter{page}{1} \pagenumbering{arabic} \mainmatter

maybe I don’t known how set section type of front matter?or what is wrong I don’t know?
Your help is appreciated.
yujian

The LaTeX template is designed to create a .tex file, which you would then use pdflatex or xelatex to create a PDF with. You would not be using Scrivener’s PDF printer, as it does not have a built-in LaTeX engine.

For this template to work the way it was designed, you need to select “Plain-Text (TXT)” as the file type, and use the compile format provided in the project in the left sidebar.

If you need manuscript formatting, you will need to make some adjustments to use a different document class, or maybe just some changes to your preamble to use different fonts and double-spaced lines, etc. There may be some guides on the 'net for how to do this.

As for where to make changes in Scrivener:

  1. Right-click on the “LaTeX (Memoir Book)” format in the left sidebar and duplicate it. This way you keep the original safe. You can rename it at the top to something else, like “LaTeX (Manuscript)”.
  2. Click on the “Text Layout” pane, and here you will find where the documentclass is set. This template is intentionally very simple so that you can easily customise it.
  3. The Front Matter folder is a good place to organise most of the preamble. My way of thinking is that the Format should change the biggest things: the document class, packages necessary for the big picture, and so on. Front Matter is better for things the project will need for itself. Consider you might choose to save this custom Format global, rather than in the project itself, so that you can use it on future books as well.

But in the end it is entirely up to you. Some might not want to have anything in the format and have all of the preamble in the front matter folder. There is no wrong way, so long as it all prints out in the correct order.

thanks AmberV
I try as you say, and meet some new problem.

  • I insatll mactex and use texshop in my mac.and it s ok for other files not from scrivener.

  • I complie as you say. it s wrong when I use this tex file. texshop tell me: Latex error: missing\begin{document}

I don’t know what’s wrong.and i have some question:

  • shoule I compile all documents(including all draft) or just front matter?

  • if I want use latex in scrivener. could I use only one format(LaTeX (Memoir Book)?
    Your help is appreciated.thanks again!
    yujian

shoule I compile all documents(including all draft) or just front matter?

You need the front and back matter added, as this is where the \begin{document} and \end{document} are. You also need the template’s provided compile Format selected (or one created from it, as we discussed), in order to get a valid document. I’ve never tried it, but there should be no necessity to have anything in the Draft folder. It will of course not be testing much other than the cover page.

if I want use latex in scrivener. could I use only one format(LaTeX (Memoir Book)?

Yes, but only in a limited way. This is of course is a statement of what is most simple to start with, if we are trying to use this template. Scrivener is not aware of LaTeX. Everything that it does when you compile, to make a .tex file, is in those compile settings, along with a little preamble and footer in the front/back matter. So if we do not use that format, there is no LaTeX! This project is a demonstration of how the compiler can be set up to create file formats that Scrivener itself has no knowledge of.

This is a more complicated approach then. For a very simple one, you can type a fully correct .tex file into one binder item in the Draft folder, in a blank project, and get correct output with no special settings at all. That is the easiest way to use the software, at least for learning. The template is more elaborate, and if you change a bunch of settings without knowing why, you likely will cause it to stop working.

Since it sounds like you haven’t written much yet, it may be easier to ditch this project, and create a fresh new one. Drag the “Sample PDF Material” folder from the Research folder into the Draft, and compile it without touching a single setting.

That should work. If it does, move the sample folder back to Research, and start writing. :slight_smile:

thanks AmberV

Drag the “Sample PDF Material” folder from the Research folder into the Draft, and compile it without touching a single setting.

I try,but it could not be permited to put pdf files or folder including pdf files into Draft.

and

  • I complie as you say. it s wrong when I use this tex file. texshop tell me: Latex error: missing\begin{document}

I don’t know what’s wrong.

My apologies, I forgot the Mac version of this template is out of date, and does not have the sample folder I referred to. Well that is not essential to testing, you can just type a few words into the “Section” sample file, in the “Chapter” folder.

I have no idea why your default settings are evidently different from what they should be though. Here is a screenshot of what the compile overview should look like, without changing anything:

  1. This needs to be set to “Plain Text”.
  2. This must be selected in the sidebar.
  3. Note the “Begin Document” item in the list? That is where \begin{document} is printed. If you do not see that item in the list, then…
  4. Make sure the front matter feature is set properly.

If that doesn’t work, it would help to send a copy of your .tex file. The error you quote can be misleading. That line may be three, but some other error from earlier in the file causes it to not be seen. I have no idea why that would be happening with stock settings though.

thanks AmberV! I found the problem: many files of front matter should be used N/A sectiontype, I have sucess when I establish new scrivener file.
but I meet a new problem.that is the chinese characters disappeared.I think its as the format for UTF-8 Unicode? can I use this way for chinese?
thanks again!
yujian

I have found some solution:

  • in format I change “\documentclass[12pt,oneside]{memoir }” to“\documentclass[12pt,oneside]{ctexbook}”,for chinese

  • in txt file I chang
    \tableofcontents

% \listoffigures
% \listoftables

\section*{Foreward}

to
\tableofcontents

\newpage
\thispagestyle{empty}
\section*{Foreward}
then I get correct pdf.
but how can I put 2th changes to scrivener?
thanks AmberV!!!

That would indeed make a mess, if the preamble items were using a presentation layout! They were probably using commands that are only valid inside \begin{document}, hence the error—exactly one of those cases where it can be misleading.

Glad to hear you figured out Chinese. If you can, you might want to use xelatex instead of pdflatex. It is much more modern, and has better support for fonts and Unicode.