Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
ghostanime2001
Posts: 402 Joined: Fri May 20, 2011 9:41 am
Post
by ghostanime2001 » Wed Dec 12, 2012 12:19 am
How do you automatically add a little space above text or math inside a square root symbol to keep consistency (for example inside quadratic formula) ?
Code: Select all
\documentclass[fleqn]{article}
\usepackage{adjustbox}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage{array}
\usepackage{auto-pst-pdf}
\usepackage{bigints}
\usepackage{bigstrut}
\usepackage{booktabs}
\usepackage{bpchem}
\usepackage{calc}
\usepackage{cancel}
\usepackage{chemfig}
\usepackage{chemmacros}
\usepackage{epstopdf}
\usepackage[shortlabels,inline]{enumitem}
\usepackage{fix-cm}
\usepackage[T1]{fontenc}
\usepackage{fouridx}
\usepackage{fullpage}
\usepackage[margin=1in]{geometry}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{lewis}
\usepackage{lmodern}
\usepackage{mathtools}
\usepackage{makebox}
\usepackage{microtype}
\usepackage[version=3]{mhchem}
\usepackage{multienum}
\usepackage{multirow}
\usepackage{nccboxes}
\usepackage{pbox}
\usepackage{pgfkeys}
\usepackage{pifont}
\usepackage{pst-math}
\usepackage{pst-node}
\usepackage{pst-plot}
\usepackage{pstricks}
\usepackage{relsize}
\usepackage{siunitx}
\usepackage{tensor}
\usepackage{tikz}
\usetikzlibrary{matrix,calc,intersections,through,backgrounds,arrows,decorations.pathmorphing}
\usepackage{textcomp}
\usepackage{type1cm}
\usepackage{ulem}
\usepackage{wasysym}
\usepackage{xcolor}
\usepackage{xfrac}
\usepackage{xspace}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\setlength{\mathindent}{0pt}
\newlist{longenum}{enumerate}{6}
\setlist[longenum,1]{label=\arabic*.}
\setlist[longenum,2]{label=\alph*)}
\setlist[longenum,3]{label=\alph*)}
\setlist[longenum,4]{label=\alph*)}
\setlist[longenum,5]{label=\alph*)}
\setlist[longenum,6]{label=\alph*)}
\newcommand{\pss}{\par\smallskip}
\newcommand{\pms}{\par\medskip}
\newcommand{\pbs}{\par\bigskip}
\newcommand{\ssa}{\\ \addlinespace[\smallskipamount]}
\newcommand{\msa}{\\ \addlinespace[\medskipamount]}
\newcommand{\bsa}{\\ \addlinespace[\bigskipamount]}
\newcommand{\since}{\raisebox{0.56pt}{\rotatebox[origin=c]{180}{$\Large\wasytherefore$}}}
\newcommand{\thus}{\Large{\wasytherefore}}
\newcommand{\ans}[3]{\ch{$\num{#1e#2}$ #3}}
\allowdisplaybreaks
\DisableLigatures{encoding = *, family = *}
\sisetup{inter-unit-product=\cdot,number-unit-product=\text{ }}
\pagestyle{empty}
\begin{document}
\begin{aligned}[t]
&\ce{x_{1,2}}=\cfrac{-\ce{b}\pm\sqrt{\ce{b^2}-\ce{4ac}}}{\ce{2a}}
\end{aligned}
\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
cgnieder
Site Moderator
Posts: 2000 Joined: Sat Apr 16, 2011 7:27 pm
Post
by cgnieder » Mon Dec 17, 2012 12:27 am
I boiled your code down to a
minimal working example:
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
x_{1,2} = \cfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\]
\end{document}
Please do this yourself next time! You're much more likely to get an answer that way!
You could define yourself a
\bigstrut
and insert it into the root:
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\newcommand*\bigstrut{%
\vrule height\baselineskip depth.3\baselineskip width 0pt\relax}
\begin{document}
\[
x_{1,2} = \cfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\]
\[
x_{1,2} = \cfrac{ -b \pm \sqrt{\bigstrut b^2 - 4ac}}{2a}
\]
\end{document}
By the way:
Code: Select all
\usepackage{graphics}% this one is redundant as
\usepackage{graphicx}% this one loads `graphics' itself
Are you really loading `microtype' to disable all ligatures?
Code: Select all
\usepackage{microtype}
\DisableLigatures{encoding = *, family = *}
Why would you do that? It is one of LaTeX's good sides that it does handle ligatures (and most of the time quite well).
Why do you misuse `mhchem' to get upright variables? Besides the fact that it really is uncommon and every mathematical typesetting guide tells otherwise (namely to typeset variables in italics) -- why don't you just use \mathrm
? This would be both easier to use and would avoid all the parsing `mhchem' does which seems a bit of an overkill just to get upright characters:
Code: Select all
\[
\mathrm{x_{1,2} = \cfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}}
\]
Out of curiosity: what do you need all the chemistry packages for:
Code: Select all
\usepackage{bpchem}
\usepackage{chemfig}
\usepackage{chemmacros}
\usepackage{lewis}
\usepackage[version=3]{mhchem}
Especially for `lewis' and `bpchem' I fail to see what they are good for when you also load `chemfig' and `chemmacros'? But maybe I'm just overlooking the obvious...
Why do you hide the start of paragraphs?
Code: Select all
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
Please don't be offended by this list but since you're acting against a lot of typographic recommendations I wonder why? Do you have to follow some style guidelines?
Regards
ghostanime2001
Posts: 402 Joined: Fri May 20, 2011 9:41 am
Post
by ghostanime2001 » Mon Dec 17, 2012 9:35 am
I am just doing it for my purpose I am not following any guidlines I didn't know one could use mathrm with & inside math environments (for ex. array)