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
3 votes
1 answer
49 views

l3build testing entire pages with the standalone class

I'm (still) in the process of trying to understand how l3build tests work, more specifically for classes, more specifically for the standaloneone. Consider the following custom class (myclass.cls) ...
2 votes
1 answer
31 views

What's the proper way to run l3build tests for classes?

I'm (still) in the process of trying to understand how l3build tests work, more specifically for classes. For this, I created a sandbox directory, the content of which being: $ tree sandbox/ sandbox/ ├...
4 votes
1 answer
111 views

Capitalizing first character of \today independently of the language

I'm writing a document class that uses the datetime2 package to write a month-year date in the title of the document. Here is a MWE: \begin{filecontents}[overwrite]{customclass.cls} \...
  • 43
0 votes
1 answer
41 views

Class option with arbitrary key value

I'm working on a personal class where I absolutely need to get a seed number before loading anything in the document. I would like the seed in the class option, something like : \documentclass[seed=...
  • 3
8 votes
0 answers
130 views

Is still xtemplates recommended for document class writers?

Suppose I'd like to create a LaTeX class based on another one (say article), with e.g. quotations or theorems with specific designs (say as tcolorbox boxes): is it still nowadays recommended to rely ...
0 votes
1 answer
51 views

Best way to automize a layout

I am new to classes and I would like to make a class that automatizes the complete layout of the document. This includes : setting a given pdf file as background, there is a different background in ...
  • 239
0 votes
0 answers
50 views

Changing font size in custom document class

I am writing my own document class and would like to include a macro that makes the main text in my document 12pt. Everyone online says to do this with \documentclass[12pt]{article} however I can't ...
  • 207
0 votes
1 answer
39 views

How to \ExecuteOptions that are handled by \DeclareOption*?

I'm writing a class file based on the report class, for which I want the default font size to be 12 pt rather than 10 pt. I tried specifying a default font size using the \ExecuteOptions{} command, ...
  • 3
2 votes
1 answer
83 views

Writing a class file from scratch and getting "Missing \begin{document}" error

I'm looking to write my own class file for a couple of reasons, but my main interest is better understanding LaTeX and how it works. I understand that I likely don't need to define my own class for ...
1 vote
0 answers
54 views

What do these commands do at the top of a class file?

I downloaded a class file and starts with the below code, would you be able to tell me what it does please? And would any of the commands become redundant whether XeLaTex/LuaLaTeX is used? I have ...
0 votes
1 answer
46 views

How to solve Undefined controll sequence in document class (.cls) file

I have to write a document class with 2 parameters (one gives a logo and one a chess board). The code for the two parameters are working fine but i get some errors and i dont know how to fix them. ...
1 vote
1 answer
50 views

Adding a text box to the bottom margin area for the title page

I am trying to form a class file for our journal. I must add a text box which contains some information about press to the bottom margin area for title page. But I didn't get the result I wanted in my ...
1 vote
1 answer
106 views

Overleaf can't find the document class when it's in a folder

I am making my own document class called MyClass in overleaf. I would like to move the cls file into its own folder called Style. How do I change the command \documentclass[Path=./Style/]{MyClass} so ...
  • 207
0 votes
0 answers
34 views

How to process base document class options in the derived class?

I want to process options passed to the base class in my derived class. Specifically, I'd like to enforce margin sizes for the article class with geometry package. Moreover, I would like to forbid ...
0 votes
2 answers
53 views

Pass LaTeX variable from DocumentClass file to class

DocumentClass MWE... \documentclass{testclass} \begin{document} \outputdirpath{../auxil} \begin{minted}{php} <?php $x = 1; if($x=1){ echo "x=1"; ...
  • 21
1 vote
1 answer
43 views

Expl3 syntax generate error and warning messages for class and LaTeX

When I do \msg_new:nnnn { module } { errorname } { explenation } and then \msg_warning { module } { errorname } i get Package module Warning:. How can I get it to say Class module Warning: or LaTeX ...
  • 1,700
0 votes
1 answer
35 views

Produce error when document exceeds a page length

I tried making an fatal error when the document exceeds a set pagelimit. I think there is some problem with my if statement, because although the document exceeds the limit there is no error. The idea ...
  • 1,700
0 votes
2 answers
80 views

How to make "fatal error"?

How do you make LaTeX stop/ abort the compilation and output a "fatal error"? I know there are a couple of ways to produce errors/warnings: \ClassError{class-name}{error-text}{help-text} \...
  • 1,700
2 votes
1 answer
45 views

Raise Package/ Class error for incompatible options

When I am writing a package or class, I sometimes have some options that are incompatible with each other. What I want is to raise an error if two such options are imported at the same time. I tried \@...
  • 1,700
0 votes
1 answer
32 views

Package/ class option for swapping text and image in header

I have a written a .cls file which has a command \makecvheader that makes a header that looks something like this: I have written some class options, and would like to add another one: an option to ...
  • 1,700
3 votes
1 answer
52 views

Write a package/ document class with babel supported commands

I am writing a latex class and would like to have a command that prints a sentence in different languages if babel is imported. If babel is not imported (detected) it will simply print the sentence in ...
  • 1,700
0 votes
1 answer
25 views

If case for publist biblatex options (for .cls file)

I have this if case I run for deciding some options for publist. I tried to use the \ExecutePublistOptions{ } to change the publist options, but it seems this doesn't work in the .cls file/ preamble. ...
  • 1,700
0 votes
1 answer
21 views

Using pictures in class file

I'm wondering how i can use a logo in a .cls file. This logo shall be on all pages of the document. The classfile looks like this: \ProvidesClass{myclass}[2022/10/27 v1.12 MyClass] \LoadClass{...
  • 159
10 votes
1 answer
315 views

Best practice for dtx workflow

I'm sorry, if this question isn't appropriate here, since it asks (at least partly) for opinions. However, there exists a "best-practices" tag, and I believe, the answer could be of public ...
  • 622
0 votes
0 answers
14 views

Defining logo insertion to the left and right side in the class file

I am trying to create a LaTeX class fille that automatically inserts two logos on the title page, one to the left and one on the right. This is how I am defining it. \def\@maketitle{% \setlength\...
0 votes
0 answers
32 views

Creating a LaTeX package that forces landscape mode

I'm trying to create a LaTeX package that will always be in landscape mode, but despite using \LoadClass[landscape]{article} and \RequirePackage[landscape]{geometry}, I'm having trouble. I've boiled ...
  • 101
1 vote
2 answers
45 views

Mixing traditional class options and pgfoptions?

I am trying to mix pgfopts with more classical options to make a custom class. The idea is that classical options would be here to provide predefined behavior, while pgfopts options would be here to ...
  • 4,507
0 votes
1 answer
17 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 ...
user avatar
4 votes
2 answers
129 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
37 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
29 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
91 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}...
  • 361
0 votes
0 answers
91 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 ...
  • 319
5 votes
1 answer
237 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 ...
  • 7,420
0 votes
0 answers
44 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 ...
  • 7,420
0 votes
1 answer
33 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, ...
  • 818
11 votes
1 answer
290 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): \...
  • 2,307
1 vote
1 answer
127 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
60 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
32 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
63 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
44 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
54 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 ...
  • 135
1 vote
1 answer
67 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
143 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.9k
2 votes
1 answer
112 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.9k
1 vote
1 answer
75 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.3k
0 votes
0 answers
792 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 ...

1
2 3 4 5
10