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

learn more… | top users | synonyms

28
votes
2answers
3k views

\newcommand vs \DeclareRobustCommand

I sort of understand the difference between the two. But that's not what I'm interested in—I just want to know, which one should I use? In general, when I'm creating commands in a package or class, ...
4
votes
1answer
807 views

Access title and author in custom class [duplicate]

Possible Duplicate: Use the values of \title, \author and \date on a custom title page How can I access the title and author in my custom class based on article, so that I can insert them ...
6
votes
1answer
131 views

Detect number of pages in custom class

How can I make a conditional in my custom documentclass (based on article) for when the document is only one page long? I need this because when it is only one page, I don't want to put the page ...
2
votes
1answer
466 views

Modify footer of first page in custom class

I know I can do \maketitle \thispagestyle{fancy} But I want my custom class that I am making (based on article) to do this for me. It already does pagestyle{fancy}, but I can't get it to change the ...
2
votes
2answers
1k views

ProcessOptions and ProcessKeyvalOptions

\ProcessOptions and \ProcessKeyvalOptions Which comes first? Does it matter? \ProcessOptions\relax or \ProcessOptions* What's the difference? Apparently for keyval there is only the starred ...
3
votes
1answer
120 views

Heading width are wrong if they are defined in a class

I created a new class based on the book class. In this class I use the package fancyhdr in order to define some heading content. In my document, I load my new class and then I set the page dimensions ...
4
votes
1answer
469 views

Problem when bidi & hyperref packages are used with custom document class (XeLaTeX)

There is a problem when bidi & hyperref packages are used together and custom document style is used. For example: \documentclass[unicode]{myreport} \usepackage{xltxtra} \author{Author} ...
5
votes
1answer
329 views

Class name that is also a trademark

I am sorry if this question is off-topic or there is a better place--feel free to move it or close with an explanation. I have no affiliation with Vistaprint. I would like to publish a class with the ...
14
votes
1answer
746 views

How does “missing \begin{document}” work?

I would like to know how does LaTeX invoke the error Missing \begin{document}. I would like to reproduce it in the sense of the following MWE (it will become a part of my own document class): ...
8
votes
2answers
549 views

Loading package twice with \RequirePackage causes “option clash”

I thought that loading a package twice with the same options cannot lead to option clash, still I get a clash in the following simple example: \documentclass{article} ...
4
votes
1answer
119 views

How do I add an option that sets a flag to a document class?

I want to add an option that sets a flag to a document class. That is, I want to be able to type \documentclass[foo]{class} and get one type of behavior, and type \documentclass{class} to get a ...
5
votes
0answers
265 views

Beginner issues about custom class files [closed]

I am trying to write my first ugly .cls for LaTeX related to the following problem which Mike and me are trying to solve (we will post soon the link to Github for people who are interested to work ...
8
votes
1answer
1k views

Using of \usetikzlibrary in an expl3 package fails

In the example below I provided a small test package mytestpackage.sty which uses the syntax of expl3. If I use the command \usetikzlibrary inside the package I will get the error: Runaway argument? ...
2
votes
2answers
265 views

Using \usebox inside a \newcommand

I have this code: %Abstracts \newcommand{\@spanishabstractname}{{\bfseries Resumen}} \newsavebox\@sabstract \newenvironment{spanishabstract}{% ...
5
votes
1answer
100 views

Where can I find spanish documentation for creating LaTeX classes?

Searching the web for spanish documentation about creating classes for LaTeX, I found this website belongs to the class of "Scientific text processing in high quality" (Procesamiento de textos ...
3
votes
1answer
813 views

Using fleqn option in a new LaTeX class

I am creating a new LaTeX class, necessarily the equations must be aligned to the left so I use the file fleqn.clo in the class code. The problem is that when using the equation environment the result ...
18
votes
3answers
1k views

Customizing LaTeX - create a document class or a package?

Are there general rules for when to create a document class vs. creating a package to customize LaTeX? Does one have benefits over the other? My specific need is to create a customized page layout, ...
4
votes
2answers
869 views

How to define a table in documentclass?

Consider a simple table in the document: \begin{tabular}{ l c r } 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{tabular} How we can define this table within the ...
4
votes
2answers
724 views

How to make onecolumn/twocolumn parts in a document class?

I have a simple document class adapted from article, but independent (.cls file). The document is twocolumn, but when I add a title with \newcommand\maketitle{\begin{titlepage}% \begin{center}% ...
4
votes
1answer
4k views

How to customize a document class?

In LaTeX, we modify a predefined documentclass to fit our need. I wonder how we can edit the original documentclass (e.g. article) to have our customized properties? I mean which file is responsible ...
21
votes
1answer
518 views

When to use “.sty” extension and when to use “.def”

I'm new to this forum and a recent LaTeX user. I state that, before posting here, I searched all the web through, but I was not succeeded to solve a doubt. I'm writing my own class (myclass.cls), ...
25
votes
5answers
7k views

How to write a LaTeX class file for my thesis

I want to design a new LaTeX for my college thesis, so that all students could use it. I have decent understanding of how LaTeX works. I am looking for some nice article explaining how to write a ...
0
votes
1answer
589 views

DocumentClass Writing [duplicate]

Possible Duplicate: Style/class tutorials I am a newbie at LaTeX. But I need start from my own text style in LaTeX. I want to setup page format, margins, paragraphs style, fonts, etc. Can ...
1
vote
2answers
784 views

custom header text and headrule

Using mweclass LaTeX class (report based) is writing a document as follows: \documentclass{mweclass} \title{MWE} \author{J. Doe} \begin{document} \thispagestyle{mwetest} \maketitle ...
29
votes
1answer
677 views

Macro naming best practice?

Is there a preferred or generally accepted idiom for naming user defined macros? I notice that in the change from Tufte 3.5.0 to 3.5.2, for example, the names of the debugging macros have change, for ...
5
votes
1answer
392 views

Minimal code to support table of contents in custom class

I'm trying to create a custom class to replace the class book and need to include ToC functionality. Placing the command \tableofcontents leads to error "Undefined control sequence". Using packages ...
2
votes
1answer
393 views

How to pass a string to a class

I have a class file where I load hyperref. Now I'd like to change the content of hyperref's \pdftitle from the main .tex file on: \RequirePackage{filecontents} \begin{filecontents}{myclass.cls} ...
3
votes
1answer
976 views

How do I load a custom class in LyX?

I'm interested in making some modifications to a standard class to use as the class for many documents I'm creating, and see that one way to do this is to simply create a "wrapper class". This ...
14
votes
3answers
387 views

Advantages of a custom class over a package and environment

What are the advantages/disadvantages of defining a class over a package and environment? I have recently started to clean up some of the cruft in the preamble of my letters. The simplest solution ...
4
votes
2answers
1k views

How to set default line spacing in a .cls file?

I am writing a document class where I want to set the default line spacing to be 1.5. How can I use the setspace package to achieve this? More particularly, where in my .cls file should I mention ...
9
votes
2answers
4k views

How to set default font size in latex cls file?

I am using a custom LaTeX document class for my thesis which is derived from the report class. I'd like to set the default size of the font to 12pt, and still have the option to change it (to 10pt) ...
1
vote
1answer
530 views

own class with twocolumns activated in \ifdefined for KOMA and xelatex

I want to do something like in http://stackoverflow.com/questions/1465665/passing-command-line-arguments-to-latex-document. For better explanation I'll show a minimal running example: My test.cls: ...
36
votes
2answers
663 views

When or why should I use %% as opposed to %?

I've noticed that many (all?) style and class files have "documentation blocks" with a double comment character at the beginning of the line, %% like so instead of the usual style of comments, % ...
4
votes
1answer
4k views

\titleformat{name=\section} in documentclass

I defined a documentclass in which I redefine a heading format with (using the package titlesec): \titleformat{name=\section} This works. But if I move this \titleformat{name=\section} to a ...
8
votes
3answers
909 views

How to write a class that accepts an optional key-value pair?

a user-defined class: \ProvidesClass{preview}[2012/12/15 v 0.01 class for creating a tight PSTricks diagram] \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax ...
1
vote
1answer
63 views

Finding Information about Class Level Commands [duplicate]

Possible Duplicate: Documentation reference for LaTeX internal commands? I'm working on writing a company-specific class file for reports in LaTeX and I thought I would start by reading ...
14
votes
2answers
597 views

Defining a wrapper class for a set of document classes

Until now, I have been collecting my "frequently used packages", custom macros, and configurations in a personal style file. However, some of those configurations depend on the use of one of the ...
17
votes
2answers
551 views

Write new package with LaTeX2e or LaTeX3

I’m planning to create a package and I wonder if it’s better do do this with LaTeX3 syntax or the „old“ LaTeX2e, which is the one I know. Will LaTeX2e packages be supported by LaTeX3? I can give ...
3
votes
1answer
392 views

How can I check/debug a .cls file?

I am editing a .cls file in order to customize the output of a particular document. However, I am occasionally coming up against errors. Is it possible to check that my .cls file is valid (i.e. no ...
3
votes
1answer
569 views

Best practice for setting package options through class options?

I want to process my class options so as to create a (potentially long) options list for package(s) I'm loading, e.g. % set default package options here somehow \DeclareOption{myvariant}{ % set a ...
6
votes
1answer
818 views

Redefine \title command in custom class

I am currently writing a custom class that inherits from a standard class (article), and I would like to redefine the \title command, so that the end user can call it, and I would be able to get the ...
3
votes
1answer
84 views

doc.sty: Print codelinenumbers in index in tt font?

Is it possible to print the index numbers which are referring to a code line number instead of a page in typewirter font. I know that I can change \main, but on this way I can’t change the format of ...
6
votes
3answers
140 views

Class/package for German documentation

I’m writing the musuos class and I’m writing the documentation with ltxdoc.cls and doc.sty which seems to work. But the documentation is in German so it’s not very nice to get (environment) in the ...
3
votes
1answer
647 views

Commercial use of LaTeX templates

I was wondering what are the licensing issues or the best way to know if certain templates allow for commercial use. I know the best way is to contact the original author but sometimes the sites don't ...
6
votes
2answers
567 views

KOMA classes and \LoadClass

I want to create a document class based on a KOMA-Script class. If myclass.cls contains the following \ProvidesClass{myclass}[2011/08/31] \LoadClass[paper=a5]{scrartcl} then compiling a document ...
7
votes
2answers
135 views

Controlling placement of package warnings in the log

Is there any way to control where in the log file or console output \PackageWarning or \ClassWarning messages get placed? I have a class warning (generated by my own document class) that gets buried ...
55
votes
4answers
1k views

What is good practice when preparing a package for CTAN?

I'm thinking of submitting a package to CTAN, and would like some hints which will help keep the path as smooth as possible for me, the CTAN administators, and the final users. Please tell me what I ...
4
votes
1answer
4k views

How to pass parameters in a class file to different packages?

I'm writing a new class file that is based on book, and thought of making it available both in an English and in a Dutch version. Easiest to do seemed passing the arguments, so I constructed following ...
7
votes
2answers
186 views

How to make certain macros defined in document class inaccessible from within an input file using it?

In C#, we can specify certain properties of a class to be private, read only, etc. I want to apply this methodology in writing LaTeX document class if it is possible. I can find articles pertaining ...
5
votes
1answer
5k views

Removing extra vertical space in \maketitle with titling package

Consider the following two LaTeX source files: First, manually producing a title using a new environment (eww): \documentclass[a4paper,10pt]{article} \parindent0cm% ...