Questions tagged [documentclass-writing]

{documentclass-writing} is about writing document classes. If your question is about choosing, installing, or using document classes, choose {documentclass} instead.

Filter by
Sorted by
Tagged with
0 votes
1 answer
16 views

Strange behavior of a macro in \LoadClass options

Consider the class file mwe.cls containing \NeedsTeXFormat{LaTeX2e} \ProvidesClass{mwe}[2022/09/26] \def\myGreatMacro{twoside=false} \LoadClass[a4paper,\myGreatMacro]{scrreprt}%% warning about ununsed ...
  • 1,545
4 votes
2 answers
113 views

\AddToHook{file/⟨file-name⟩/before}{\ExplSyntaxOff} seems to be ineffective

(The current question is related to Using of \usetikzlibrary in an expl3 package fails, at least somehow.) Suppose a (expl3) class of mine, myclass, provides a way to configure it at the document ...
1 vote
1 answer
34 views

Preserve space in \@classoptionslist

I noticed that \@classoptionslist removes whitespace of the options. Is it possible to prreserve this whitespace? %\documentclass[12pt]{scrartcl} %\begin{filecontents*}{myclass.cls} % \ProvidesClass{...
1 vote
0 answers
28 views

Is it possible to merge the documentclass file and the main tex file? [duplicate]

A normal TeX file looks something like this (MWE): \documentclass{article} \begin{document} Contents \end{document} In this case, one must have two files in order for the document to be compiled : ...
0 votes
0 answers
24 views

Interaction between global and local options

I'm trying to achieve a specific behavior between global and local options within my own class. The example below does not work as intended. Other attempts also failed. \begin{filecontents*}[overwrite]...
  • 879
0 votes
1 answer
29 views

How to put 'envelop' for corresponding author at the bottom?

I am writing a paper, James and Henry are both co-first authors, and Henry is the corresponding author. Below is the code. \documentclass[runningheads]{elsarticle} % \setlength{\belowdisplayskip}{3pt}...
  • 171
0 votes
0 answers
34 views

How to modify Springer Article template to published version?

I want to modify Springer Article template to a custom similar article template such as custom logo, custom Journal name and etc. But the online available latex template of Springer-related Article is ...
  • 263
6 votes
1 answer
149 views

As of 2022, how should one build class/package options without l3keys2e? [duplicate]

In a comment of this question,David Carlisle wrote: [l3keys2e] should be considerd legacy now, the new built in option code is based on the same core expl3 code but extended and improved so hopefully ...
  • 6,811
0 votes
0 answers
35 views

New conditional to test package version

By now, how should one write the code that does if the package <package> is newer than <version>, do <thing A>; otherwise do <thing B>? I'm aware of \@ifpackagelater, but I ...
  • 6,811
0 votes
1 answer
29 views

Printing text at top of page with 0 separation at the top, using own class file

I want to produce a LaTeX document that looks like the following: That is, when you start typing text, it appears at the top left part of the page and continues from there. In order to achieve that, ...
  • 384
11 votes
1 answer
275 views

What happens when a package patches another, and then the original one is reloaded?

I'm in the process of cleaning up my class file and I'm unclear as for the proper order of some lines. For example (replacing \RequirePackage with \usepackage and putting this in a MWE): \...
  • 1,762
1 vote
1 answer
91 views

Unused global option with multi-staged options in koma-script

We use koma-script for a wide range of different documents, e.g. reports and short legal documents. I would like to make our documents more consistent. My idea was to create a package (myBase.sty) ...
0 votes
0 answers
39 views

setspace complicates custom class: best workaround?

Background – class with 'transparent' key–value options I have a custom class for thesis-like docs that allows setting fonts, styles, lengths, and rubber lengths with key–value options. It's a work in ...
0 votes
0 answers
32 views

Converting an overleaf text into Latex [duplicate]

I have written a paper in Overleaf. I can't convert it into a LaTeX file. Is there any special way to do that. For example the document class is \documentclass[graybox]{svmult} but in LaTeX it has not ...
  • 1
0 votes
0 answers
30 views

Best practices for class authors: configurable names / translations

How should I suggest document authors rename elements that my class provides, either because they're not writing in English, or because they need to change a word or two? Here are three tools, each ...
1 vote
1 answer
57 views

cleveref conflicts with polyglossia when required in a class

When I run the following MWE (with xelatex): % File myclass.cls \NeedsTeXFormat{LaTeX2e} \ProvidesClass{myclass} \LoadClass[12pt]{article} \RequirePackage{polyglossia} \RequirePackage{cleveref} % ...
1 vote
0 answers
32 views

how does the nested \def in \def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}

I am trying to understand the following code: \def\author{\@dblarg\beamer@author} \long\def\beamer@author[#1]#2{% \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}#2}% } ...
2 votes
1 answer
36 views

How to enforce a first-page style in a documentclass?

I've written a documentclass in which I've defined a \fancypagestyle from fancyhdr for the first page. But the user of my documentclass needs to call \thispagestyle{firstpagestyle} in order for this ...
  • 125
1 vote
1 answer
48 views

How to change default options of a document class?

I'm trying to define a custom class rs-book.cls based on a standard class book.cls and would like to change some of the default options. For instance, by default (with no options given), the command \...
2 votes
2 answers
96 views

What license (if any) should I choose for this document class?

About 10 years ago, I inherited a not-officially-licensed document class for Ph.D, plus a sample skeletal thesis. theses in my alma mater's CS department. I've been maintaining and improving it on ...
  • 11.7k
2 votes
1 answer
86 views

How can I get the effect of indexonlyfirst for a single glossary?

Consider the following document: \documentclass{article} \usepackage{glossaries-extra} \newglossary[nlg]{notation}{not}{ntn}{Notation} \makeglossaries \newglossaryentry{symb:c}{type=notation,name=$c$, ...
  • 11.7k
1 vote
1 answer
65 views

Manipulating csv lists and nested csv lists with expkv using custom class file

This is a followup question to Class with keyval option consisting of lists of keyval pairs. In an answer to that question, Skillmon showed how to write a class that would provide a command, \people, ...
  • 12.1k
0 votes
0 answers
399 views

latex article cls

I'm developing a template for an article in Latex using specific class. I have a problem showing 4 errors when compiling. Attached the predefined class together with the tex source file. I appreciate ...
0 votes
0 answers
63 views

University dissertation package/cls table captions broken by subcaption and subfigure. How to fix?

I'm trying to write my dissertation, and I've run into an issue where the subcaption and subfig packages break the caption formatting for tables. For an example, the table number label shows up as, &...
  • 1
0 votes
1 answer
140 views

Trouble with \hfill not going to the end of the page

I am new at creating a class file to maintain a specific format for my resume. I included all the code from the template I am using to prevent any compiling issues. I am trying to line up my dates at ...
  • 1
0 votes
1 answer
148 views

IF statement in .cls file. How to control it from .tex file?

Minimum working code is attached herewith. If I change 1 to 0 in \newcommand{\numsections}{1}, I get heading without number, and to get numbered heading, I have to go to .cls file. I don't want the ...
2 votes
1 answer
51 views

Correct way to/best practice for using a custom class for my university?

I've written a really nice, pretty comprehensive class for my particular department's particular way of doing things. I've also got biblatex citation and bibliography styles. Once I have them a bit ...
0 votes
1 answer
43 views

Understand commands of a class file

I haven't much experience with TeX/LaTex and I am trying to write a CV based on this repository. Specifically, I am trying to understand how a LaTeX class file is written, and reproduce to a certain ...
7 votes
3 answers
219 views

Are there any LaTeX commands (including in packages) where the argument will be in math/text mode based on context?

As I work on the parser for finl, I'm contemplating how I'm dealing with command parameters and wondering if my current setup is sufficient. Right now, a parameter has a type which would either be ...
  • 13.2k
0 votes
0 answers
35 views

Should I write down a module or a .cls file?

I have delved recently into the world of LyX modules and layouts. From what I understand, layouts instruct LyX to style the document while the user works on it, and modules allow the user both to ...
  • 384
2 votes
1 answer
212 views

Children book/picture book template

I got inspired by the book "Newtonian Physics for Babies" and other books by Chris Ferrie. So I wanted to gift a children book to someone in my family. The book will be a first encounter ...
  • 1,052
3 votes
0 answers
73 views

Can I use a package (passing it options) in a class definition which can also be used (with \usepackage, more options) in a document?

I'm writing a document class for my faculty. Most users will be relatively casual, non-expert with LaTeX and I want to cause them minimal fuss and work when using the class. In service of this, I ...
0 votes
1 answer
45 views

Conditionally add author to header

I've a documentclass myclass that's based on KOMA-script's scrartcl class. MWE: myclass.cls \NeedsTeXFormat{LaTeX2e} % The document class name \ProvidesClass{myclass} % https://tex.stackexchange.com/...
  • 27
1 vote
5 answers
286 views

Making a note using LaTeX and finding the formatting of a specific book

I really want to make my own notes in a friendly format, obviously using LaTeX. But, since I have a little knowledge about LaTeX and its functions, I go through some books, articles, online notes ...
  • 11
6 votes
1 answer
119 views

Does multiple \AtBeginDocument calls execute code in the appearing order

Let's say I have these two simple files myclass.cls : \LoadClass{article} \AtBeginDocument{\typeout{IN CLASS}} myfile.tex \AtBeginDocument{\typeout{BEFORE CLASS}} \documentclass{myclass} \...
0 votes
1 answer
55 views

Is it possible to prevent class options from being passed to some packages?

I have an option named indent in my document class. However, some of the packages loaded also have this option, and since the option is written in \documentclass[...]{myclass} as a global option, it ...
  • 6,811
3 votes
1 answer
138 views

\PassOptionsToClass{\CurrentOption} not working

I get an error which I don't understand. I have the following cls-file called error.cls \NeedsTeXFormat{LaTeX2e} \ProvidesClass{error} \DeclareOption*{\...
  • 707
1 vote
0 answers
54 views

Best practice for dealing with bidi's redefinitions for class authors

As is well-documented elsewhere, bidi.sty does a lot of redeclarations and assumes that the author is using one of a small set of document classes. For use of packages, one can fiddle with the order ...
  • 13.2k
3 votes
0 answers
75 views

Class/package: design vs code

LaTeX3 team often reminds us: "Classes really should be about formatting/style/etc., not functionality. The latter should be added by packages, which ideally would be independent of the classes ...
1 vote
1 answer
20 views

Using amsart indirectly as a base class of another class changes the way the date is printed

I created a custom document class based on amsart. When I used it instead of amsart, to my great surprise this changed the way the date is printed in the footnote of the first page: instead of Date: ...
  • 1,709
1 vote
1 answer
55 views

Document class that places a figure on a specific page

I'm trying to write a document class with a twocolumn layout such that when a document is written using that class, a certain figure, e.g. a logo, is always inserted on a specific page - say, page 10. ...
  • 253
1 vote
1 answer
81 views

How can I specify page numbering for \chapter headers to be in the top right corner?

I wrote my own Dissertation .cls file and I'm not sure how to make my chapter page numbers located in the top right-hand corner. I believe the base class is report and not article. I was using an ...
3 votes
0 answers
68 views

How to override a base class's default options in a derived class

Apologies if this is answered somewhere else; I've seen several questions with similar titles but I can't seem to determine how the answers would apply to my case. What I would like to do is define a ...
  • 657
2 votes
0 answers
29 views

How can I change margin and block size in a class definition based on Memoir? [closed]

Given the following example: test.cls: \NeedsTeXFormat{LaTeX2e} \ProvidesClass{test} \LoadClass[article,oneside]{memoir} \setstocksize{3in}{3in} \settrimmedsize{3in}{3in} %\setlrmarginsandblock{5pt}{...
  • 11.1k
2 votes
0 answers
54 views

How does the user set geometry in a class that loads fancyhdr?

In my class, I defined the header style with fancyhdr. This causes trouble when the user wishes to modify the geometry settings, since geometry configuration should happen before fancyhdr. Below is an ...
  • 6,811
0 votes
0 answers
18 views

How to change to helvetice font in class based on class option? [duplicate]

I want to based on a class option change to using Helvetica as font, the simplest way I found to do this would be to load the helvet package. But if I do that like: \DeclareOption{foo}{ \...
  • 11.1k
1 vote
0 answers
173 views

Any reference and tutorial on writing .cls file class? [closed]

I was trying to re-edit the report.cls file to adapt to our institution thesis presentation format. I was stuck at declaring and executing options,also with error flag on xcolor file execution. Having ...
0 votes
0 answers
125 views

Switching my existing class from LaTeX2e to expl3 syntax

It has been my dream to rewrite my existing class with the expl3 syntax, as (I believe that) the code would be much clearer and would be easier to maintain by then. One year ago, while searching on ...
  • 6,811
1 vote
0 answers
42 views

Writing a class + template with default sections

I'm right now writing a class for technical manuals to be used inside my company. This class holds e.g. the company logo and defines some macros for e.g. specific Corporate Identity styling of code ...
  • 278
1 vote
1 answer
204 views

Increasing the font size makes the font smaller instead

I screen capped my workspace in overleaf below: The font size was initially at 12 pts as is in the command \documentclass[titlepage,12 pt]{article}. When I tried increasing the font size to 14 by ...
  • 151

1
2 3 4 5
9