0

I was wondering whether it would be possible to edit the titles and the entities displayed in the structure bar of texstudio? Firstly I have code inside the \part titles, which the structure bar writes out, rather than just display the name of the part. I have tried taking the code out, and placing it around the \part command but obviously that did not work, and the code had no effect on the font. Secondly, I am keeping my chapters in separate .txt files in order to make it easier and more manageable for me to locate various errors and information. However, this means, that the chapters and sections are not displayed in the structure. Rather, the file names are displayed, and I have to click each one to see the list of headings, which does not fold out underneath the names of the input files, but instead at the bottom of the list of parts and input files. Is it possible to change the settings such that either or both of these issues goes away? Or to solve it in any other way?

Minimal Example

\documentclass[12pt,a4paper,onecolumn,oneside,final]{memoir}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{newcent}
\usepackage[utf8x]{inputenc}
\begin{document}
\clearpage
\chapterstyle{hangnum1}
\part*{\textsc{\fontsize{35}{45}\selectfont{Part title 1}}}
\input{1.txt}
\part*{\textsc{\fontsize{35}{45}\selectfont{Part title 2}}}
\input{2.txt}
\part*{\textsc{\fontsize{35}{45}\selectfont{Part title 3}}}
\input{3.txt}
\end{document}

Content of .txt files

1.txt:

\chapter{chapter title 1}

2.txt:

\chapter{chapter title 2}

3.txt:

\chapter{chapter title 3}
Faergen
  • 531
  • 5
  • 14

1 Answers1

1

Formatting of sectioning commands:

You should try to avoid explicit formatting within your document whenever possible. LaTeX is designed to separate content and format. By defining \part{title} you define that the text has the semantics of a part-heading. At this place, you should not worry how a part-heading is to be formatted. See these two questions:

Change section fonts

Change size of section subsection ...

As an additional benefit, the definition of the format is in one place and not spread out across your whole document. This makes later changes much easier.

Document structure:

Showing a structure that is spread out across multiple documents is currently not supported in TeXstudio. This is still an open feature request.

Additional recommendations:

  1. You should name your sub-files .tex because they actually contain tex code.
  2. For .tex files you should leave out the extension. In fact, the LaTeX compiler first looks for <filename>.tex and only if that does not exist, it falls back to <filename>. I.e. \input{1.txt} would first look for 1.txt.tex.
  3. You might want to use \include over \input for inclusion of document parts. See When should I use input vs include for details.

IMHO a standard multi-file document would look like this

main.tex

[preamble left out for brevity]
\begin{document}
\clearpage
\chapterstyle{hangnum1}
\include{part1}
\include{part2}
\include{part3}
\end{document}

part1.tex

\part{Part 1 Title}

Here comes the contents
Tim Hoffmann
  • 11,159