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
24 views

Error occurred when using tocloft package in LaTeX file

I want to write a document class myself, which uses the tocloft package to edit the TOC format. An error occurs when compiling a TeX file using this document class: ! Undefined control sequence. l.3 \...
Zifan Zhang's user avatar
0 votes
1 answer
36 views

How to calculate the initials of author given names within the article, not in bibliography

I am writing a new class for a journal. To introduce the authors and affiliations information, an author has just to insert this in his/her article \author[1]{Name1 Surname1} \author[2]{Name2 Surname2}...
TrAmA's user avatar
  • 15
0 votes
0 answers
66 views

Stretching vertical space and reducing badness at the bottom of a page

Problem Is there a way in TeX/LaTeX to somehow reduce the badness which comes from a distance of a line from target height of a page? Context I am creating a document class for my students to use ...
lpszTemp's user avatar
7 votes
1 answer
138 views

Why do I get "unused global options warning" for options forwarded to a package except for the first option?

I am working on a custom package for my macros and shortcuts, and a custom class for my preferred style of the document. I am using DeclareKeys to define key-value options in my package, and then my ...
Shai Avr's user avatar
  • 685
0 votes
1 answer
53 views

Can't pass choices option to package

I am trying to make a custom package to contain all my personal macros and a custom class for my personal style. I wanted to pass a keyword argument notation which can take a value of math or physics ...
Shai Avr's user avatar
  • 685
4 votes
1 answer
143 views

How to let LaTeX forget that a class has been loaded?

Consider the two files % mydoc.tex \documentclass{myclass} \begin{document} \end{document} % myclass.cls \LoadClass[x]{myclass} When LaTeXing mydoc.tex, I get two errors (the second one after ...
gernot's user avatar
  • 49.3k
10 votes
3 answers
535 views

Avoid spurious warnings in a parasitic class with key-value options (LaTeX3 \DeclareKeys)

This is a modified version of "Unused global options(s)" when using arguments in options of class. The question is how to create a parasitic class (i.e. one which loads another) which ...
cfr's user avatar
  • 196k
2 votes
2 answers
116 views

How to define a new font family without specifying a font in advance (using the default one instead)?

I want to setup a semantic font family for my class with \newfontfamily\COMPONENTFont{XXX}. Users of the class are free to use their font of choice for COMPONENT, for instance font YYY: \...
Polizi8's user avatar
  • 301
1 vote
1 answer
46 views

Toggle to hide minted environment

For a syllabus .cls I'm updating for work, I already have a answer environment, that is only shown when the documentclass is provided the answers toggle (by default, the class receives noanswer). I ...
pkok's user avatar
  • 63
0 votes
1 answer
187 views

Editing multiple text files in Overleaf

I'm working on a class file in Overleaf, and would like to be able to have the editing tab for the class file and the main file open at the same time, rather than needing to repeatedly switch between ...
Justin Murante's user avatar
3 votes
1 answer
113 views

LaTeX for Companies

I work with a small company (10 people). I've been a LaTeX user for roughly 20 years. We have been trying to implement LaTeX as the primary document preparation system in our company with varying ...
cole's user avatar
  • 31
3 votes
0 answers
138 views

General (dis)advantages of ways to define new commands

I have a question about the many ways to define a new command. I looked through the web and TeX.SE but couldn't find a complete answer (only some partly answers like, here, here, here, or here). I ...
lukeflo's user avatar
  • 1,545
7 votes
1 answer
188 views

What command should supersede \DeclareRobustCommand?

In section 6.1 of clsguide.pdf (link: https://www.ctan.org/pkg/clsguide), under "Commands superseded for new material", the class guide lists the command \DeclareRobustCommand and \...
User23456234's user avatar
  • 1,727
3 votes
1 answer
65 views

Options not passing through class file with \LoadClass command

The following code works fine and gives expected output. \documentclass[fontsize=14pt,twoside,a4paper]{book} \usepackage[T1]{fontenc} \usepackage[none]{hyphenat} \usepackage{scrextend} \usepackage{...
user61681's user avatar
  • 1,739
1 vote
1 answer
67 views

l3build testing several tcolorbox theorems: what would be the best way?

(I'm (still) in the process of trying to understand how l3build tests work.) Suppose I'd like to l3build a test for a class (based on standalone class, but I guess it is of little importance here) ...
Denis Bitouzé's user avatar
3 votes
1 answer
64 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) ...
Denis Bitouzé's user avatar
2 votes
1 answer
56 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/ ├...
Denis Bitouzé's user avatar
4 votes
1 answer
141 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} \...
Pedro's user avatar
  • 43
0 votes
1 answer
86 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=...
Vince's user avatar
  • 65
10 votes
0 answers
168 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 ...
Denis Bitouzé's user avatar
0 votes
1 answer
60 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 ...
John's user avatar
  • 239
0 votes
0 answers
88 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 ...
curry's user avatar
  • 283
0 votes
1 answer
136 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, ...
Frink's user avatar
  • 47
2 votes
2 answers
155 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 ...
Metomorphose's user avatar
1 vote
0 answers
59 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 ...
SockPile's user avatar
0 votes
1 answer
109 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. ...
Nutellafreak's user avatar
1 vote
1 answer
98 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 ...
Bluerose's user avatar
1 vote
1 answer
593 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 ...
curry's user avatar
  • 283
0 votes
0 answers
71 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 ...
Robert Manson-Sawko's user avatar
0 votes
2 answers
81 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"; ...
Mike A's user avatar
  • 31
2 votes
1 answer
145 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 ...
Vebjorn's user avatar
  • 1,778
0 votes
1 answer
65 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 ...
Vebjorn's user avatar
  • 1,778
0 votes
2 answers
131 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} \...
Vebjorn's user avatar
  • 1,778
2 votes
1 answer
53 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 \@...
Vebjorn's user avatar
  • 1,778
0 votes
1 answer
48 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 ...
Vebjorn's user avatar
  • 1,778
3 votes
1 answer
74 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 ...
Vebjorn's user avatar
  • 1,778
0 votes
1 answer
34 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. ...
Vebjorn's user avatar
  • 1,778
0 votes
1 answer
32 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{...
flymg's user avatar
  • 179
11 votes
1 answer
380 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 ...
Matthias's user avatar
  • 644
0 votes
0 answers
21 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\...
sciencejedi's user avatar
0 votes
0 answers
56 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 ...
Sam's user avatar
  • 101
1 vote
2 answers
71 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 ...
Vincent's user avatar
  • 5,163
0 votes
1 answer
18 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
164 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 ...
Denis Bitouzé's user avatar
1 vote
1 answer
58 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{...
likethevegetable's user avatar
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 : ...
beaniehat's user avatar
0 votes
0 answers
38 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]...
rolfn's user avatar
  • 939
0 votes
1 answer
297 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}...
James's user avatar
  • 415
0 votes
0 answers
207 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 ...
C.F.G's user avatar
  • 552
6 votes
1 answer
449 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 ...
Jinwen's user avatar
  • 8,226

1
2 3 4 5
10