Tag Info

New answers tagged

2

Like Harish I would suggest to use utf8 instead of ucs/utf8x, but if for some reason you really need utf8x you must prerender the offending unicode character: \documentclass[a4paper]{report} \usepackage[T1]{fontenc} \usepackage[utf8x]{inputenc} \PrerenderUnicode{ø} \begin{document} \tableofcontents \chapter{ø} \end{document}


1

Use \usepackage[utf8]{inputenc} instead of utf8x \documentclass[a4paper]{report} \usepackage[utf8]{inputenc} \begin{document} \tableofcontents \chapter{ø} \end{document}


3

Your professor should know better. This teaches nothing about LaTeX, in my opinion; using packages is the way. But here it is; it includes a (perhaps too clumsy) implementation of Euclid's algorithm for the greatest common divisor, in order to pass a correct pair of values to \line. \documentclass{article} \makeatletter \newcommand{\crossout}[1]{% ...


2

Your Professor wants you to learn TeX, he is a wise man! Try the below code. \documentclass{article} \usepackage{xcolor} \makeatletter \newbox\@tempboxb \def\cancel#1{% \leavevmode \setbox\@tempboxa\hbox{#1} \setbox\@tempboxb\hbox{x} \hbox to 0pt{\hbox to \wd\@tempboxa ...


0

May be this is what you are asking: \documentclass{article} \usepackage{blindtext} \usepackage{tocloft} \renewcommand{\cftsecdotsep}{7} \renewcommand\cftsecleader{\bfseries\large\cftdotfill{\cftsecdotsep}} \renewcommand{\cftsubsecdotsep}{4} \renewcommand\cftsubsecleader{\normalsize\cftdotfill{\cftsubsecdotsep}} \renewcommand{\cftsubsubsecdotsep}{1} ...


2

The solution is to use \textbar for the “pipe” in text mode (| is good in math mode). You seem to be using a very old template and I don't think you should be loading the IL2 package. The test \ifx\pdfoutput\undefined is a clear sign of this; note that on current TeX distributions (less than five year old or so), the test will always return false.


0

Here's a dirty workaround. Let me know if you run into trouble using this (I hope not). \documentclass[cover]{fitthesis} % odevzdani do wisu % \documentclass[english]{fitthesis} % zde zvolime kodovani, ve kterem je napsan text prace % "latin2" pro iso8859-2 nebo "cp1250" pro windows-1250, "utf8" pro "utf-8" %\usepackage{ucs} ...


0

I solved by using: \appendix \chapter{Blah blah} \includegraphics[scale=0.5]{blah blah} \includegraphics[scale=0.5]{blah blah} I was sure to having already tried it...


3

You can do something like this \documentclass{article} \usepackage{amsmath,amsthm,amssymb} \def\imp{\rightarrow} \newenvironment{level}% {\addtolength{\itemindent}{2em}}% {\addtolength{\itemindent}{-2em}} \begin{document} \section{formal proof} \textbf{(a)} \begin{proof}\leavevmode \begin{enumerate} \item $r$ \hfill(Given) \begin{level} ...


1

I think it might be best to use a package designed for typesetting this kind of proof. lplfitch is probably closest. It draws rules to mark the scopes but these can be eliminated with the help of etoolbox. The following patches the main proof command \fitchprf so that the rules have 0pt for the duration of the proof. The regular width of rules in tabulars is ...


1

You can use enumerate and enumitem \documentclass[11pt]{article} \usepackage{amsmath,amsthm,amssymb} \def\imp{\rightarrow} \usepackage{enumitem} \begin{document} \section{formal proof} \textbf{(a)} \begin{proof}\leavevmode \begin{enumerate}[ref=\arabic*] \item $r$ \hfill(Given) \item $(t \land r) \imp s$ \hfill (Given)\label{enum:second} ...


2

Before I give you an answer, I would like to give you couple of notes about the problems of your approach. Firstly, you should update whole File A even for small changes (instead of only changing what needs to be changed). In other words, this approach doesn't scale. Secondly, it is somehow breaking one of the nicest features of LaTeX, i.e., the possibility ...


1

This requires all section titles use the optional argument, but at least does the breaking you require. \documentclass{scrartcl} \usepackage[normalem]{ulem} \usepackage{hyperref} \renewcommand\othersectionlevelsformat[3]{% \ifnum\pdfstrcmp{#3}{\thesection}=0 \uline{#3\autodot\enskip}% \else #3\autodot\enskip \fi } \begin{document} \section ...


4

I suggest one of my favourite packages: tcolorbox \documentclass{article} \usepackage{tcolorbox} % A new `\tcbox` command \newtcbox{\highlight}[0]{boxsep=0pt,left=0pt,top=0pt,bottom=0pt,right=0pt,boxrule=0pt,arc=0pt,auto outer arc,colback=green,width=6cm} \begin{document} \highlight{black text on a boxed green background} ...


2

\fcolorbox is like \fbox or \mbox and makes a horizontal (LR) box, so you need \textbf{\fcolorbox{black}{green!30}{% \parbox{3cm}{black text on a boxed green background}}} replacing 3cm by whatever width you need.


3

A simplification of the already answered: \documentclass{article} \def\D{\par\noindent\makebox[1em][l]{-- }\hangindent1em} \begin{document} \subsubsection*{This is a header} \D This is a detail \D This is a detail that has too many words in it and consequently runs onto The next line of the page, and I want it to have a hanging indent. \end{document}


2

\documentclass{article} \newcommand{\detail}[1]{\par\noindent\hangindent=\mylen\hangafter1--\,\,#1} \newlength{\mylen} \settowidth{\mylen}{--\,\,} \begin{document} \noindent\textbf{This is a header} \detail{This is a detail.} \detail{This is a detail that has too many words in it and consequently runs onto the next line of the page, and I want ...


8

\documentclass{article} \newcommand{\detail}[1]{\par\noindent\hangindent=\mylen\hangafter1-- #1} \newlength{\mylen} \settowidth{\mylen}{-- } \begin{document} \noindent\textbf{This is a header} \detail{This is a detail.} \detail{This is a detail that has too many words in it and consequently runs onto the next line of the page, and I want it to ...


7

TeX inserts no interline glue before and after \hrule, so you have to teach it that you want to respect distances independently of ascenders and descenders. The simplest way is to use struts: \documentclass{article} \usepackage{enumitem} \newenvironment{category}[1] {\par\noindent\textbf{\strut#1\strut} \medskip % <-------- adjust here \hrule % ...


8

The \hrule in the vertical material breaks the baselineskip-grid because it resets the internal \prevdepth register. But you can save the value of the register to a variable, print \hrule and restore this register. Then the baselineskip-grid can be kept. Normal behavior: Previous line \hrule % this rule is printed immediately below the line without ...


5

You can remove the descender-depth by using \raisebox. The following definition of \raisebox is contained in source2e.pdf: \raisebox{⟨distance⟩}[⟨height⟩][⟨depth⟩]{⟨box⟩} Raises ⟨box⟩ up by ⟨distance⟩ length (down if ⟨distance⟩ negative). Makes TeX think that the new box extends ⟨height⟩ above the line and ⟨depth⟩ below, for a total vertical length ...


4

Please always post the code not just an image of code. You only showed a tiny fragment but it shows that you are missing most of the features of latex to automate numbering, layout and cross references. Possibly something like the following would be a reasonable markup, then the layout can be adjusted if needed without changing the markup, which is a major ...


0

Actually, you don't have to remove the ulem package, since it could be useful somewhere else. Use the \normalem and \ULforem commands provided by the ulem package. The conditions of algorithm2e package are emphasized, and ulem package by default replaces italics with underlining for all emphasized text, that's why underlines appear automatically when using ...


0

I would suggest a small improvement: your lines beginning with a hyphen have an itemize structure, so I used enumitem to format itemize with endashes. A length was missing as the 4th argument of \titleformat{\section}{…}: \documentclass{report} \usepackage[letterpaper,margin=1in]{geometry} %\usepackage{fancyhdr} \usepackage{amsmath ,amsthm ,amssymb} ...


2

The command \titlespacing expects three lengths. so they should be something like \titlespacing{\chapter}{0pt}{0pt}{4pt} and \titlespacing{\section}{0pt}{5pt}{5pt} Also you have /end{document} instead of \end{document} I don't know what you are trying to achieve, but this is your modified MWE: \documentclass{report} ...


1

Ok, I ended up doing the following: I first defined a style outside of the actual \tikzpicture: \pgfplotsset{ default style/.style={ xbar, xmin=0, width=12cm,enlarge y limits=0.5, xlabel={Travel time [s]}, ytick=data, nodes near coords, nodes near coords align={horizontal}, every node near coord/.append style={/pgf/number ...


1

The issue here is that you haven't specified where the float can actually go. This means that it will go to the default position defined by the document class. As you're using the article class that means the default is [tbp]. Your table appears to be at the top of the page. So you can either tell it to go somewhere else with, for example, h or arguably if ...


1

Here is a simple solution for only the non-italic text. I think it also looks fine with italic text, but maybe you disagree. \documentclass{article} \usepackage{amssymb} \begin{document} sample$\Box{}$text \textit{sample$\Box{}$text} \end{document}


5

This makes use of two really nice answers. Joseph Wright at Detect which text "mode" (normal, italic, bold, etc.) is currently in use? tells how to determine the current font shape, which I use to determine if I am in italic or not. Bruno at Shear transform a "box" shows how to slant a box. Together, I use Bruno's \slantbox to slant ...


1

A small solution, but it doesn't look very nice ;-) \documentclass[a4paper, 12pt]{article} \usepackage{xcolor} \setlength{\fboxsep}{0pt} \begin{document} 1818{\color{red}\framebox{X}}cBb-1day \textit{1818{\color{red}\framebox{X}}cBb-1day } \emph{1818{\color{red}\framebox{X}}cBb-1day } \end{document} Some improved version for slanted boxes (and ...


1

I think I found a solution, but it is not elegant. Basically, I went through the .cls file and added additional entries. I created new entries "chapterA" for everything that had "chapter". For the makechapterhead definitions, I changed raggedright to centering. Thus, I create centered chapters in the appendices with \chapterA{asdf}


3

Since you're writing sub-figure captions and references manually, my suggestion would be to use a macro like the following: \newcommand{\figref}[2][]{% \figref[<sub-figref>]{<figref>} \textcolor{ocre}{\bfseries\emph{\figurename\,\ref{#2}#1}}} This allows you to use \figref{<figref>} to reference full figures, or ...


2

You can do that easily with the ntheorem package (instead of amsthm) and etoolbox. I also loaded the enumitem package to improve the layout of itemize environments in such context. Here is a possible code: \documentclass[11pt,a4paper,openany]{report} \usepackage[utf8]{inputenc} \usepackage{amssymb, mathrsfs} \usepackage[dutch]{babel} \usepackage{lmodern} ...


3

By default, LaTeX puts equation numbers flush with the margin (for flush left use \documentclass[leqno]{...}). The reason for this, I suspect, is that this makes it much easier for the reader to find the equation numbers by scanning down the left or right margin. If you really want to change the default behaviour, and ignore best practice and all the ...


0

How about a command with a color parameter? \newcommand\tln[1]{\tabularnewline\arrayrulecolor{#1}\hline} Then in your table Some name &Sometext &Sometext &100 & &x & & & & &\tln{green} Some name &Sometext &Sometext &100 & &x & & & & ...


4

You are already using package amsmath and have therefore \tfrac, which puts the fraction in the math style \textstyle: \documentclass[10pt]{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{geometry} \geometry{a4paper, total={14.5cm, 23cm}} \newcommand*{\diff}{\mathop{}\!d} \begin{document} The amplitude $u_2 (x_2, y_2)$ at the back focal ...


2

First \center is wrong. Use \centering. And change the title command like this: % ------------------------------------------------ {\setstretch{1.5} \Huge\bfseries \nameJojo \par\vspace{\baselineskip}} % the name of the class %% or \onehalfspacing or \doublespacing % ------------------------------------------------ Full code: ...


6

You can use hbox \documentclass{article} \usepackage[most]{tcolorbox} \begin{document} \tcbset{ enhanced, colback=red!5!white, boxrule=0.1pt, colframe=red!75!black, fonttitle=\bfseries } My own shadow \begin{tcolorbox}[title=My own shadow,hbox, %%<<---- here lifted ...


3

Perhaps there is natural width option, I did not find it. A small workaround: Wrap the text into a box and get the width of it: \documentclass{article} \usepackage[most]{tcolorbox} \begin{document} \newsavebox{\mybox} \savebox{\mybox}{This is a tcolorbox} \tcbset{ enhanced, colback=red!5!white, boxrule=0.1pt, ...


3

enumitem offers specialised ways to customise lists which was why it was recommended in this case. If you look at the documentation, you'll appreciate that the point is to abstract away from the need to use the lower level LaTeX list configuration macros. The following example shows one way. I very much doubt I have Warnock Pro so I created a MWE sans the ...


5

I tried the sample article and found that loading subfig with the proper option works: \usepackage[caption=false]{subfig} Adding this to the sample file \begin{figure}[h!] \subfloat{X}\quad\subfloat{Y} \caption{\csentence{Sample figure title.} Figure legend text.} \end{figure} gives the following result:


2

Your citations are in a c column and that won't spread itself over multiple lines, unlike a p column. To get a centered p type column, load the array package and add >{\centering\arraybackslash} before the p declaration. Alternatively, additionally load the ragged2e package and use its \Centering command instead of \centering, this allows better ...


1

Instead of redefining the innards of the savequote environment directly, I would load the etoolbox package and use its \BeforeBeginEnvironment and AfterEndEnvironment macros to place the material of the entire savequote environment inside a singlespace environment. Do distinguish between the environment versions of the macros of the setspace package (e.g., ...


2

Here are some options, depending on your input preference. They all produce the following output: Consistent use of \\ to end the question: \documentclass{article} \newenvironment{QandA} {\begin{enumerate} \let\olditem\item \long\def\item##1\\{\olditem{\bfseries ##1}\par}} {\end{enumerate}} \begin{document} \begin{QandA} \item This is a ...


0

You can bold any number of words in the line. However, bolding a line is very difficult, since TeX must decide where to split the line, and this depends on the font. After the line is split, you need to return to the original tokens, but they are already "lost". Many years ago Jim Sterken formulated this problem in 1983: ...


1

My solution needs no packages. Only, what you need to know, is that the primitive registers \day, \monthand\year` include the desired information. \def\mydate{\leavevmode\hbox{\the\year-\twodigits\month-\twodigits\day}} \def\twodigits#1{\ifnum#1<10 0\fi\the#1} The date in my format: \mydate.


4

\text.... commands escape to text mode so use the current text font settings. Math fonts do not change according to the local context and here you want the math monospace font so use \mathtt{MinimumPolynomial}


1

Use the package datetime2 \usepackage[iso]{datetime2}


0

The easiest way is to input the text as you want to see it into the edition field, for example edition = {edisi ketiga} This, of course, is not that automatic, as we would like it to be. For some languages (where the word for edition does not vary with the number of the edition) \DeclareFieldFormat{edition}{% \ifinteger{#1} ...


3

You can't have a normal environment to straddle two table cells, because you would have \begin{env} in one cell and \end{env} in another one and cells form groups. You can do what you want with environ and \aftergroup trickery: \documentclass[a4paper, 10pt]{scrartcl} \usepackage{environ} \NewEnviron{TableRow}[3]{% \toks0=\expandafter{\BODY}% ...



Top 50 recent answers are included