Posts

Showing posts with the label latex

How to insert table of content in the report using LaTeX

Image
Hi everyone, welcome to my blog where I share some tips and tricks on using LaTeX, a powerful document preparation system. Today, I'm going to show you how to insert a table of content in your LaTeX document. A table of content is a list of the sections and subsections of your document, along with their page numbers. It helps your readers to navigate your document and find the information they need. It also gives an overview of the structure and organization of your document. To insert a table of content in LaTeX, you need to use two commands: \tableofcontents and \section. The \tableofcontents command tells LaTeX where to place the table of content in your document. Usually, you put it right after the \begin{document} command. The \section command tells LaTeX the title of each section of your document. You can also use \subsection and \subsubsection commands to create sub-levels of sections. Here is an example of a LaTeX document with a table of content: ...

LyX not showing math font properly

Problem: I faced this problem after reinstalling Linux Mint on my computer. I simply installed the LyX, TeXLive and other LaTeX-related software. But when I started using LyX, it was not showing the math fonts properly. It was showing ‘a’ instead of ‘alpha’ or ‘b’ instead of ‘beta’, even though its corresponding latex code was correct, and the pdf output was correct. See the following figure for more clarity. Reason: One of the required packages of LyX is fonts-lyx, which is needed to visually display the math symbol in LyX. It was not automatically installed in when I installed LyX, and hence the math symbols were not visible properly. Solution: The solution is simple. Just install the fonts-lyx package from the package manager or from the command line. To install it from the command line, use the following command. sudo apt install -y fonts-lyx That’s all, this should solve the problem. Cheers A.Paul

Changing page style defination of "fancyhdr" package.

In this post I will show how to change the definition of the page style (say empty) if you are using fancyhdr package. Just add the following type of code in the preamble of the document (before the \begin{document} ): \fancypagestyle{empty}{% \fancyhf{} % clear all header and footer fields \fancyfoot[R]{\bfseries \em \thepage } % except the center \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{1pt}} Here you can use all kind of fancyhdr package command to specify you options and formatting. Hope this will be helpful. Cheers APaul

Placing float (table or figure) at the top of the page in otherwise empty page in LaTeX

In latex if a table is going to any empty page (page with only that table and no other text), the table is always aligned vertically centre. And that does not look good always. Even the float place holder like [t] or [ht] or [t!] kind of things does not work. But there is a work around, just paste the following code at the preamble of the document (before \begin{document} ); \makeatletter \setlength\@fptop{0\p@} \makeatother Hope this will solve the problem. Cheers APaul

Creating local texmf directory in TexLive which can be synchronize

Okay, here is what I exactly wanted to do; I have to work on several computer and laptop. So I wanted to create local texmf directory in some cloud service folder (like dropbox) and then sync them across the different computer. But the problem is the local texmf directory in TexLive in Ubuntu is /usr/local/texlive/texmf-local So I have created a symbolic link of the texmf directory of dropbox inside the /usr/local/texlive/texmf-local/tex/latex/ . It is working fine. Hope this will work for you also. Cheers APaul

bclogo package to produce boxed and highlighted text in LaTeX

Image
When we write article, sometime we need to highlight some portion (may be some comment, idea, home task or some hint) to differentiate it from the rest of the article. LaTeX gives us a very good and elegant way to do the job using bclogo package. Here I will describe how to use bclogo package. First you have to load the package using \usepackage[tikz]{bclogo} . And the syntax is as followis: \begin{bclogo}[options]{title} content text \end{bclogo} For example \documentclass{article} \usepackage{lipsum} \usepackage[tikz]{bclogo} \author{Apurba Paul} \title{check boxed minipage} \begin{document} \begin{bclogo}{title} some text \end{bclogo} \end{document} The above code will produce something like this You can also change the background color, shape of the rectangle and the the logo. For example the following code will produce something like the next image: \documentclass{article} \usepackage{lipsum} \usepackage[tikz]{bclogo} \author{Apurba Paul} \title{check boxed m...

Using boxedminipage environment in LaTeX

Boxedminipage is an environment that is used in LaTeX to crate a pseudo page environment with border around it in your actual page. Here I am saying how to use it. First import the package using \usepackage{} command in the preamble. \usepackage{boxedminipage} Syntax to use this package is \begin{boxedminipage}{<width_of_the_minipage>} minipage content \end{boxedminipage} This environment can be used if you want to put some thing together but it is spliting up over more than one pages because this create a float, and so the box will not allow to creat page break inside it like figure environment. Also you can use this environment to place some text at the lift or right not extending more than one line. Like we put address, salutation, or header in Letter. If you don't want box around it yo can use minipage environment. Here I am giving a simple example \documentclass{report} \usepackage{boxedminipage} \author{APaul} \title{Example of boxedminipage en...

Page no positioning in latex using fancyhdr package.

 We can manually position the page no. in LaTeX using fancyhdr package. To position page no. (or any other thing) in header or footer there are total six position options, left, right and centre in header and footer. The corresponding commands are given in the table bellow position fancy head command left header \lhead right header \rhead centre header \chead left footer \lfoot right footer \rfoot centre footer \cfoot And the page no inserted by the command \thepage . Now suppose I want to insert page no in the left side of each page I can use following code: \documentclass[a4paper, 11pt]{report} \usepackage{amsmath}%just some package not necessary to \usepackage{graphicx}%test this page no. \usepackage{fancyhdr} \pagestyle{fancy} %declaring page style \lhead{\thepage} %page no inserted in left side of header \chead{} \rhead{} \lfoot{} \cfoot{} \rfoot{} \author{Apurba~Paul} \title{Inserting page no in custom position in \L...

Refreshing tex installation in Windows and Ubuntu

In miktex go to admin>settings (admin) and in general tab click refres FNDB button In texlive in Ubuntu go to root directory by command cd / then run the command sudo texhash or you can run command texconfig and a window will open up with lots of option, choose "rehash rebuild file name data base".   Cheers APaul

Changing caption width in latex

In this post I will discuss how to change the width of the figure caption. You can use the same technique to change the width of the other caption (like table caption). Here I am using the caption package. In caption package you can specify the width while loading the package or latter using \captionsetup command. Syntax of the both command are as following \usepackage[<option>]{caption} and command for captionsetup is \captionsetup[<float type>]{<option>} In the <option> we can use width=0.8\textwidth to specify width of the caption. If we specify that in the time of loading (i.e. when using with \usepackage command) it will affect all the float (like figure, table) but if you specify it in command \usepackage then you can specify float type. Then the specific float type will only be effected. This way you can specify two different width for different float. You can also specify other kind of formatting (like italic text) usi...

How can I explain the meaning of LaTeX to my grandma? Tex.SE question with some beautiful answer.

The first line of the question asked by Stefan Kottwitz in Tex.SE ( Here ) is like this I wrote a book about LaTeX, and my proud grandma wanted to have a copy. So she got it, said "What a beautiful picture on the cover!" and - "What is this, LaTeX?". So here the main moto is how to explain what is TeX or LaTeX to a non technical person.  This seems to be very interesting question and the answer are equally interesting too. I just wanted to share the question to every one so I just sharing it in my blog. Cheers APaul

Adding more than one author with different affiliation in LaTeX

Image
We can manage more than one author with different affiliation using \authblk package. Here I am giving a simple example and its output. \documentclass{article} \usepackage{authblk} \author[1]{First Author} \author[2]{Second Author} \author[1]{Third Author} \author[2]{Corresponding Author\thanks{email@2nduniversity.com}} \affil[1]{First Department, University1} \affil[2]{Another Department, Another University} \title{Author Affiliation with authblk} \date{} % \begin{document} \maketitle Main Part of your document (including abstract) here. \end{document} And the output will look like Also you can use any other symbol instead of 1,2. You can also add email id for other author also. It will automatically change the symbol accordingly. hope This Will help Source:  http://ctan.org/pkg/authblk http://tex.stackexchange.com/questions/9594/adding-more-than-one-author-with-different-affiliation Cheers A.Paul

Subtitle in latex

Image
There is no direct command to define subtitle in latex. But you can define the \subtitle command using titling package. To do this just insert the following code in the preamble of the latex file. \usepackage{titling} \newcommand{\subtitle}[1]{%   \posttitle{%     \par\end{center}     \begin{center}\large#1\end{center}     \vskip0.5em}% } And then you can define subtitle using the following command. \subtitle{Subtitle Here} This will show the subtitle bellow your title when you use \maketitle command. Minimum working example Code \documentclass[10pt,a4paper]{article} \usepackage{lipsum} \usepackage{titling} \newcommand{\subtitle}[1]{% \posttitle{% \par\end{center} \begin{center}\large#1\end{center} \vskip0.1em}}% \title{This is the title of the document} \subtitle{This is subtitle} \author{Apurba Paul} \date{January 08, 2013} \begin{document} \maketitle Body of the document. \lipsum[1] \end{document} Output ...

Using Indian rupee symbol in LaTeX

Image
On 15 July 2010 Indian Government accepted ₹ as Indian Rupee symbol . After accepting there was numerous attempt was made to bring the symbol to the digital world. Unicode U+20B9 was assigned to it. Also almost all modern operating system support inserting the symbol by some method. As one of the finest word processor LaTeX also support ₹ symbol.  TechFa t has created a package called tfrupee , which can be used to write rupee symbol in latex document. Let's see how to use it, first installation. Installation: Miktex: If you are using Windows then probably you are using Miktex as latex distribution. It is very easy to install any package in miktex. You can use miktex package manager to install it. First go windows Start button>Miktex>Administration>Package Manager . Search for tfrupee there and select it and click in "+" symbol to install it. If you have installed complete miktex 2.9 then probably it is already installed in your computer. ...

Configuring Texstudio to use Internal pdf viewer in user defined quick build

Image
LaTeX ( pronounced  as la-tech or ly-tech) is a macro package for TeX created by Leslie Lamport. This is a document processor software which creates  professional  document and typesetting, specially if you are writing scientific document and contained lots of equation, figure and table. This is kind of markup language, so you just create a logical structure of document and the formatting is taken care by LaTeX. This is different form the other popular document processor like MS Word or Open Office Writer where you can see formatting of the document directly, but here you can only see the structure of the document not the formatting. But since this is a command based kind of document processor you have to remember lots of command to create a document, which is bit difficult. Also there is huge chance that you will make some mistake in the commands of the document, which will then create problem when you will compile the document, and you will not get any output....