Home > tikz pgf > How do I achieve consistent font sizing in a tikz circuit?

How do I achieve consistent font sizing in a tikz circuit?

May 16Hits:2
Advertisement

When creating a circuit using the tikz circuits library, the objects may have a variety of different constructions. There may be labels containing fractions and there may be ordinary paths with labels. I have found that the font sizes are variable, which can make the resulting circuit difficult to read.

Here is my minimal working example:

\documentclass{standalone}  \usepackage{amsmath}  \usepackage{tikz} \usetikzlibrary{arrows,circuits.ee.IEC,positioning}  \begin{document}  \begin{tikzpicture}[circuit ee IEC,x=2cm,y=1.5cm, every info/.style={font=\footnotesize}, small circuit symbols, set inductor graphic=var inductor IEC graphic, set diode graphic=var diode IEC graphic, set make contact graphic= var make contact IEC graphic] % Set the font size  % Let us start with some contacts: \foreach \contact/\x in {0/0,2/3} { \node [contact] (upper contact \contact) at (\x,4) {}; \node [contact] (lower contact \contact) at (\x,0) {}; } \node [coordinate] (upper right limit) at (6,4) {}; \node [coordinate] (lower right limit) at (6,0) {};  \draw (upper contact 0) to [current direction={near start,info=$I_1$},resistor={info={$\text{R}_1$}},inductor={near end,info={$\text{jX}_1$}}] (upper contact 2); \draw (upper contact 2) to[current direction={near start,info=$\text{I}_2$},inductor={near end,info={$\text{jX}_2$}}] (upper right limit)     to[resistor={info={$\frac{\text{R}_2}{\text{s}}$}}] (lower right limit)     to (lower contact 2)     to ++(0,1) coordinate (lower fork) {}     -- ++(-1,0) to[resistor={info={$\text{R}_\text{m}$}}] ++(0,2)     to ++(1,0) coordinate (upper fork) {}     to [current direction'={info=$\text{I}_\text{m}$}] (upper contact 2); \draw (upper fork) -- ++(1,0)     to[inductor={info={$\text{jX}_\text{m}$}}] ++(0,-2)     to (lower fork); \draw[color=blue,thick,->] (upper contact 0) ++(0,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_1$} -- ++(0,-1.5); \draw[color=blue,thick,->] (upper contact 2) ++(2,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_\text{Err}$} -- ++(0,-1.5); \draw (lower contact 2) -- (lower contact 0);  \end{tikzpicture}  \end{document} 

How do I achieve consistent font sizing in a tikz circuit?

The U1 and UErr voltage labels are larger than those of the resistances and inductances, and the R_2/s on the right is especially small.

Now, I can put font size parameters in front of the label text, just as I would in a regular LaTeX document, but the problem with this is that the starting size of every text element seems to be different, so I have to adjust the size by trial and error for every label.

If I put something like \large right at the start of the tikzpicture environment, then only the U1 and UErr labels are affected.

Is there a clean way of achieving a consistent font size for every label?

Answers

The small resistance and inductance labels are caused by the style every info/.style={font=\footnotesize}, which applies to the part labels. To get the same font size for all text, remove that style, and replace it with every node/.style={font=\large} in your tikzpicture options. To make the fraction use larger text, use \dfrac instead of \frac:

How do I achieve consistent font sizing in a tikz circuit?

\documentclass[border=5mm]{standalone}

\usepackage{amsmath}

\usepackage{tikz}
\usetikzlibrary{arrows,circuits.ee.IEC,positioning}

\begin{document}

\begin{tikzpicture}[circuit ee IEC,x=2cm,y=1.5cm,
every node/.style={font=\large},
small circuit symbols,
set inductor graphic=var inductor IEC graphic,
set diode graphic=var diode IEC graphic,
set make contact graphic= var make contact IEC graphic]
% Set the font size

% Let us start with some contacts:
\foreach \contact/\x in {0/0,2/3}
{
\node [contact] (upper contact \contact) at (\x,4) {};
\node [contact] (lower contact \contact) at (\x,0) {};
}
\node [coordinate] (upper right limit) at (6,4) {};
\node [coordinate] (lower right limit) at (6,0) {};

\draw (upper contact 0) to [current direction={near start,info=$I_1$},resistor={info={$\text{R}_1$}},inductor={near end,info={$\text{jX}_1$}}] (upper contact 2);
\draw (upper contact 2) to[current direction={near start,info=$\text{I}_2$},inductor={near end,info={$\text{jX}_2$}}] (upper right limit)
    to[resistor={info={$\dfrac{\text{R}_2}{\text{s}}$}}] (lower right limit)
    to (lower contact 2)
    to ++(0,1) coordinate (lower fork) {}
    -- ++(-1,0) to[resistor={info={$\text{R}_\text{m}$}}] ++(0,2)
    to ++(1,0) coordinate (upper fork) {}
    to [current direction'={info=$\text{I}_\text{m}$}] (upper contact 2);
\draw (upper fork) -- ++(1,0)
    to[inductor={info={$\text{jX}_\text{m}$}}] ++(0,-2)
    to (lower fork);
\draw[color=blue,thick,->] (upper contact 0) ++(0,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_1$} -- ++(0,-1.5);
\draw[color=blue,thick,->] (upper contact 2) ++(2,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_\text{Err}$} -- ++(0,-1.5);
\draw (lower contact 2) -- (lower contact 0);

\end{tikzpicture}

\end{document}

Related Articles

  • How do I achieve consistent font sizing in a tikz circuit?

    How do I achieve consistent font sizing in a tikz circuit?May 16

    When creating a circuit using the tikz circuits library, the objects may have a variety of different constructions. There may be labels containing fractions and there may be ordinary paths with labels. I have found that the font sizes are variable, w

  • CSS Font-Sizing: a Definitive Guide

    CSS Font-Sizing: a Definitive GuideAugust 20

    Font sizing in CSS sounds as though it should be easy. Until you try it. Many developers use the force; they tinker with the font-size property until it looks right only to find it's different in another browser. A little understanding can go a long

  • XeLaTeX and EPS figure with consistent fontsNovember 13

    I'm using Miktex 2.9 and XeLaTeX plus some EPS figures. For consistent fonts throughout the document, I used to play with psfrag or directly use pstricks. I'm facing the situation where none of the above works. Instead, I'm now using the \put command

  • Keep one consistent font spacing and face in Evernote

    Keep one consistent font spacing and face in EvernoteAugust 30

    How do I get Evernote to display consistent font spacing and typefaces when viewing the app? I basically only use the Windows downloaded app and the iPhone app and never actually change the font but it seems like I end up with a couple different font

  • Consistent font size in EPS image that are scaled?

    Consistent font size in EPS image that are scaled?February 7

    Assume that at creation time (of an EPS image) the final 'size' of the image is not known. However, this one EPS is used multiple times in different sizes within different documents. But the font size of text (e.g., axes labels) should be consistent.

  • font sizing and sharepoint em px ptMarch 9

    How are you handling font sizing with Sharepoint? Just curious on how things are working out. We seem to have a mix of px, pt, and em scattered everywhere among our CSS. I'm trying to clean things up, but it seems like EM might not be the best route

  • The New CSS3 Relative Font Sizing UnitsJanuary 14

    It's been more than three years since I last wrote about CSS font sizing. For a decade we were lumbered with inconsistent keywords (small, medium, large etc) and flawed fixed units (px, pt, mm). While the problems associated with px in Internet Explo

  • OpsCenter - DSE Cassandra - Cannot achieve consistency level LOCAL_ONEJune 4

    I am running into this error on a OpsCenter node with DSE Cassandra installed locally. It is in it's own DC and part of a cluster with three other nodes in another DC. Authentication is enabled on the cluster with org.apache.cassandra.auth.PasswordAu

  • Consistent font size when using standalone TikZ pictures in a beamer presentation

    Consistent font size when using standalone TikZ pictures in a beamer presentationFebruary 17

    I want to include a TikZ picture in a beamer presentation using the standalone package and I want a consistant size of the text in the picture and the rest of the frame. \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \bea

  • How to achieve consistent results in a home studio, when I can't leave my rig set up for too long April 24

    I'm going to start shooting videos of myself in a small room in my apartment, using a DSLR camera and a simple three-point lighting kit. I'll mostly record guitar lessons, so the camera angle and lighting setup is important and have to be consistent

  • PDF form created in Libre Office - trouble with form fields and font sizingApril 10

    I am trying to create a PDF Form using LibreOffice. I can create the form elements and export as PDF. However, the form fields are giving me problems. The text in these fields always centers on the bottom, and often the text you input is cut off at t

  • Achieving consistent branding for all SharePoint 2013 sitesApril 8

    I see that a lot of the discussions and documentation tend to be focused on branding solutions for publishing sites and understandably so. We have a lot of other types of sites too (e.g. communities, team sites) so it'd be great to have a branding so

  • Using a font sizing command in \addcontentsline does not work for ccfonts or cmbright

    Using a font sizing command in \addcontentsline does not work for ccfonts or cmbrightDecember 19

    If you comment out \large in the code, it works. The toc level doesn't matter. Any thoughts? \documentclass{article} %\usepackage{ccfonts} \usepackage{cmbright} \begin{document} \addcontentsline{toc}{section}{{% \large foo\hfill}}% \end{document} ---

  • Use Consistent Font and Font Size when Pasting into SharePoint Rich Text FieldFebruary 19

    we paste a lot of information into our multi line sharepoint 2010 list fields from other sources. We want to be able to bring in items like bullets and tables but want to enforce a universal font and font size. It wouldn't make sense to origintally a

  • How can I achieve consistent colours in my app on different mobile displays?

    How can I achieve consistent colours in my app on different mobile displays?April 27

    We are working on a mobile game that will run on iOS and Android devices. The graphic theme has been designed during the first steps of the development by a single person. Now he's no more an active part of our team (he was enrolled exclusively for t

  • Consistent label sizing with Data Driven PagesJune 30

    I've set up a map document with a number of maps, using DDP with a polygon feature class as an index layer. Two of the layers have labels and I need to manually adjust the position of many of the labels. The only way I know to do this is by convertin

  • How can I achieve consistent skin tones in my photographs?April 11

    I've been shooting more people recently and have noticed that their skin tones are all over the map depending on the lighting situation. Are there any best practices or tips to ensure consistent and accurate representation of skin tones? I am not sur

  • Any Alternative fix for printing a webpage when designed with vmin/vmax/vw/vh-font-sized textsJanuary 21

    So i am working on a fluid responsive design and the text size on the website works based on %. Just realized that if i try to print(cmd+p) the website design breaks on chrome. Looks like a pretty old and known issue and was not able to find a hack o

  • Achieving consistent RGB Composite Settings using ArcPy?August 21

    Does anyone know if there is an arcpy tool so that when I bring in raster imagery (Specifically Landsat) into ArcMap it will automatically adjust the settings of the RGB composite? I know under Raster Layer, under ArcMap options you can somewhat set

  • Font size macro in tikz font style

    Font size macro in tikz font styleFebruary 11

    I have a set of tikz styles I use for multiple tikzpictures in my document. These styles are in nodestyle.tex. I can optionally modify the size in those styles by doing \newcommand{\trnodesize}{1em} before \input{nodestyles}. I want to do the same fo

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.468 s.